package com.wicket.okrcomponent.biz.service.nb;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.wicket.okrcomponent.biz.service.dto.common.*;
 import com.wicket.okrcomponent.biz.service.dto.req.*;
 import com.wicket.okrcomponent.biz.service.dto.res.*;
 import com.wicket.okrcomponent.common.baseinfo.BaseInfoDO;
 import com.wicket.okrcomponent.common.baseinfo.BaseInfoHolder;
 import com.wicket.okrcomponent.common.exception.Assert;
 import com.wicket.okrcomponent.common.exception.BizException;
 import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
 import com.wicket.okrcomponent.common.util.DateTimeUtil;
 import com.wicket.okrcomponent.common.util.RedisUtil;
 import com.wicket.okrcomponent.common.util.eDutil;
 import com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter;
 import com.vladsch.flexmark.util.data.MutableDataSet;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.kafka.clients.admin.*;
 import org.apache.kafka.clients.consumer.Consumer;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.apache.kafka.clients.consumer.ConsumerRecords;
 import org.apache.kafka.clients.consumer.OffsetAndMetadata;
 import org.apache.kafka.clients.producer.Producer;
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.apache.kafka.common.TopicPartition;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.neo4j.driver.Driver;
 import org.neo4j.driver.Record;
 import org.neo4j.driver.Result;
 import org.neo4j.driver.Session;
 import org.neo4j.driver.internal.InternalNode;
 import org.neo4j.driver.internal.value.NodeValue;
 import org.neo4j.driver.types.Node;
 import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.apache.commons.text.StringEscapeUtils;

 import com.vladsch.flexmark.util.ast.Document;
 import com.vladsch.flexmark.parser.Parser;
 import com.vladsch.flexmark.html.HtmlRenderer;

import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;

 import org.apache.poi.xssf.usermodel.XSSFWorkbook;

 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.time.LocalDateTime;
 import java.time.temporal.ChronoUnit;
 import org.jsoup.Jsoup;

 import javax.annotation.Resource;
 import javax.validation.constraints.NotNull;

/**
 * @author ： 手工接入方法
 * @since 2022/5/28 15:32
 *
 *
 * @version 1.0
 */
@Service
public class NbInterfaceMode {

    @Resource
    private RedisUtil redisUtil;

    @Resource
    private Driver driver;
/**
      * code:multiCollectionRemoveExistingData
      * name:M2执行数据集相减得结果（特殊方法）
      * desc:undefined
      * gen by moon at 9/22/2022, 2:29:13 AM
      * 
      **/
     @Trace(operationName = "M2执行数据集相减得结果（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetSubtractResultsRespDto implementDataSetSubtractResults(ImplementDataSetSubtractResultsReqDto reqDto) {
         ImplementDataSetSubtractResultsRespDto retData =  new ImplementDataSetSubtractResultsRespDto();
         List<Long> filteredList = new ArrayList<>();
         for(Long one : reqDto.getAllSingleFieldDataSetList()){
             if(!reqDto.getDataSetSingleFieldPartList().contains(one)){
                 filteredList.add(one);
             }
         }
         retData.setDataSetSubtractResultsList(filteredList);
        return retData;
      }
/**
      * code:collectionRemoveExistingData
      * name:M2-执行集合去除已存在的数据服务(公共)
      * desc:undefined
      * gen by moon at 11/3/2022, 9:54:16 PM
      * 
      **/
     @Trace(operationName = "M2-执行集合去除已存在的数据服务(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCollectionRemoveExistingDataComRespDto implementCollectionRemoveExistingDataCom(ImplementCollectionRemoveExistingDataComReqDto reqDto) {
         ImplementCollectionRemoveExistingDataComRespDto retData = new ImplementCollectionRemoveExistingDataComRespDto();
         if(CollectionUtil.isEmpty(reqDto.getAllSingleFieldDataSetList())){
             return retData;
         }
         if(CollectionUtil.isEmpty(reqDto.getDataSetSingleFieldPartList())){
             retData.setDataSetRemoveExistingResultsList(reqDto.getAllSingleFieldDataSetList());
             return retData;
         }
         List<Long> filteredList = new ArrayList<Long>(reqDto.getAllSingleFieldDataSetList());
         filteredList.removeAll(reqDto.getDataSetSingleFieldPartList());
        retData.setDataSetRemoveExistingResultsList(filteredList);
        return retData;
      }
/**
      * code:collectionRemoveDuplicateData
      * name:M2执行数据集记录去重（特殊方法）
      * desc:undefined
      * gen by moon at 11/5/2022, 8:39:32 PM
      * 
      **/
     @Trace(operationName = "M2执行数据集记录去重（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AssemblyDataSetDuplicateRemovalRespDto assemblyDataSetDuplicateRemoval(AssemblyDataSetDuplicateRemovalReqDto reqDto) {
         AssemblyDataSetDuplicateRemovalRespDto retData = new AssemblyDataSetDuplicateRemovalRespDto();
         List<String> filteredList = reqDto.getDataSetDuplicateRemovalList().stream().distinct().collect(Collectors.toList());
         retData.setDataSetDuplicateRemovalList(filteredList);
        return retData;
      }

    /**
     * code:filterDataDelNullRecord
     * name:M2-执行数据集去除非空值数据
     * desc:undefined
     * gen by moon at 11/6/2022, 2:58:39 AM
     *
     **/
    @Trace(operationName = "M2-执行数据集去除非空值数据")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
    public ImplementDataSetRemoveUnNullDataRespDto implementDataSetRemoveUnNullData(ImplementDataSetRemoveUnNullDataReqDto reqDto) {
        ImplementDataSetRemoveUnNullDataRespDto retData = new ImplementDataSetRemoveUnNullDataRespDto();

        for(DataSetRemoveNullDataDto one : reqDto.getDataSetRemoveNullDataList()){
            if(one.getOutputNum()==null){
                retData.getDataSetRemoveNullDataList().add(one.getCommPrimaryKey());
            }
        }
        return retData;
    }
/**
      * code:dataSetPlusOneAssembly
      * name:M执行数据集加一条记录(特殊方法)
      * desc:undefined
      * gen by moon at 11/6/2022, 11:18:18 PM
      * 
      **/
     @Trace(operationName = "M执行数据集加一条记录(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public DataSetPlusOneAssemblyRespDto dataSetPlusOneAssembly(DataSetPlusOneAssemblyReqDto reqDto) {
         DataSetPlusOneAssemblyRespDto retData = new DataSetPlusOneAssemblyRespDto();
         List<String> retList = new LinkedList();
         retList.add(reqDto.getCommPrimaryKey());
         retList.addAll(reqDto.getDataSetPlusOneList());
         retData.setDataSetPlusOneList(retList);
        return retData;
      }
/**
      * code:dataSetEachSingleValueComparison
      * name:M21执行数据集每条与单数值比较(特殊方法)
      * desc:undefined
      * gen by moon at 11/6/2022, 11:18:37 PM
      * 
      **/
     @Trace(operationName = "M21执行数据集每条与单数值比较(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetEachSingleValueComparisonRespDto implementDataSetEachSingleValueComparison(ImplementDataSetEachSingleValueComparisonReqDto reqDto) {
         ImplementDataSetEachSingleValueComparisonRespDto retData = new ImplementDataSetEachSingleValueComparisonRespDto();
         if(reqDto.getCalcMaxAndMin().equals("MAX")){
             Double target = CollectionUtil.max(reqDto.getDataSetEachSingleValueComparisonList());
             if(target.doubleValue() > reqDto.getCalcPara2().doubleValue()){
                 retData.setLogicalOperator("GREATER_THAN");
             }else if(target.doubleValue() == reqDto.getCalcPara2().doubleValue()){
                 retData.setLogicalOperator("EQUAL");
             }else if(target < reqDto.getOutputNum()){
                 retData.setLogicalOperator("LESS_THAN");
             }
         }else if(reqDto.getCalcMaxAndMin().equals("MIN")){
             Double target = CollectionUtil.min(reqDto.getDataSetEachSingleValueComparisonList());
             if(target.doubleValue() > reqDto.getCalcPara2().doubleValue()){
                 retData.setLogicalOperator("GREATER_THAN");
             }else if(target.doubleValue() == reqDto.getCalcPara2().doubleValue()){
                 retData.setLogicalOperator("EQUAL");
             }else if(target.doubleValue() < reqDto.getCalcPara2().doubleValue()){
                 retData.setLogicalOperator("LESS_THAN");
             }
         }
        return retData;
      }
/**
      * code:dataSetSumOfSingleValueComparison
      * name:implementDataSetSumOfSingleValueComparisonAssembly
      * desc:undefined
      * gen by moon at 11/6/2022, 11:18:54 PM
      * 
      **/
     @Trace(operationName = "implementDataSetSumOfSingleValueComparisonAssembly")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetSumOfSingleValueComparisonRespDto implementDataSetSumOfSingleValueComparison(ImplementDataSetSumOfSingleValueComparisonReqDto reqDto) {
         ImplementDataSetSumOfSingleValueComparisonRespDto retData = new ImplementDataSetSumOfSingleValueComparisonRespDto();
         Long target = 0L;
         for(Long one : reqDto.getDataSetSumOfSingleValueComparisonList()){
             target = target + one;
         }
         if(target > reqDto.getOutputNum()){
             retData.setLogicalOperator("GREATER_THAN");
         }else if(target == reqDto.getOutputNum()){
             retData.setLogicalOperator("EQUAL");
         }else if(target < reqDto.getOutputNum()){
             retData.setLogicalOperator("LESS_THAN");
         }
        return retData;
      }

    /**
     * code:maxOrMinOfMultipleNum
     * name:M2计算数据集最大小值记录（特殊方法）
     * desc:undefined
     * gen by moon at 11/7/2022, 4:05:58 AM
     *
     **/
    @Trace(operationName = "M2计算数据集最大小值记录（特殊方法）")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
    public CalculateDataBigMiniRecordRespDto calculateDataBigMiniRecord(CalculateDataBigMiniRecordReqDto reqDto) {
        CalculateDataBigMiniRecordRespDto retData = new CalculateDataBigMiniRecordRespDto();
        DataMiniRecordDto max = new DataMiniRecordDto();
        DataMiniRecordDto min = new DataMiniRecordDto();
        if(CollectionUtil.isEmpty(reqDto.getDataMiniRecordList())){
            return retData;
        }
        for(DataMiniRecordDto one : reqDto.getDataMiniRecordList()){
            if(reqDto.getCalcMaxAndMin().equals("MAX")){
                if(max.getOutputNum()==null){
                    max = one;
                }else{
                    if(one.getOutputNum() > max.getOutputNum()){
                        max = one;
                    }
                }
            }else if(reqDto.getCalcMaxAndMin().equals("MIN")){
                if(min.getOutputNum()==null){
                    min = one;
                }else{
                    if(one.getOutputNum() < min.getOutputNum()){
                        min = one;
                    }
                }
            }
        }
        if(reqDto.getCalcMaxAndMin().equals("MAX")){
            retData.setContentID(max.getContentID());
            retData.setOutputNum(max.getOutputNum());
        }else if(reqDto.getCalcMaxAndMin().equals("MIN")){
            retData.setContentID(min.getContentID());
            retData.setOutputNum(min.getOutputNum());
        }
        return retData;
    }
/**
      * code:subtractionOfTwoNum
      * name:M2-计算两个数值相减(特殊方法)
      * desc:undefined
      * gen by moon at 11/7/2022, 11:24:47 PM
      *
      **/
     @Trace(operationName = "M2-计算两个数值相减(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public CalculateSubtractOfTwoNumComRespDto calculateSubtractOfTwoNumCom(CalculateSubtractOfTwoNumComReqDto reqDto) {
         CalculateSubtractOfTwoNumComRespDto retData = new CalculateSubtractOfTwoNumComRespDto();
         if(reqDto.getCalcPara1()!=null && reqDto.getCalcPara2()!=null){
             retData.setCalcResult(reqDto.getCalcPara1()-reqDto.getCalcPara2());
         }
        return retData;
      }
/**
      * code:getDataCount
      * name:M2-执行统计数据集条数(特殊方法)
      * desc:undefined
      * gen by moon at 11/7/2022, 11:25:00 PM
      *
      **/
     @Trace(operationName = "M2-执行统计数据集条数(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCountNumberDataSetsComRespDto implementCountNumberDataSetsCom(ImplementCountNumberDataSetsComReqDto reqDto) {
         ImplementCountNumberDataSetsComRespDto retData = new ImplementCountNumberDataSetsComRespDto();
         if(CollectionUtil.isNotEmpty(reqDto.getCountNumberDataSetsList())){
             retData.setOutputNum(Long.valueOf(reqDto.getCountNumberDataSetsList().size()));
         }else{
             retData.setOutputNum(0L);
         }
        return retData;
      }
/**
      * code:divisionOfTwoNum
      * name:M2-计算两个数值相除服务(特殊方法)
      * desc:undefined
      * gen by moon at 11/10/2022, 10:38:53 PM
      * 
      **/
     @Trace(operationName = "M2-计算两个数值相除服务(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public CalculateDivisionOfTwoNumComRespDto calculateDivisionOfTwoNumCom(CalculateDivisionOfTwoNumComReqDto reqDto) {
         CalculateDivisionOfTwoNumComRespDto retData = new CalculateDivisionOfTwoNumComRespDto();
         if(reqDto.getCalcPara1()!=null && reqDto.getCalcPara2()!=null){
             retData.setCalcResult(reqDto.getCalcPara1()/reqDto.getCalcPara2());
         }
         return retData;
      }
/**
      * code:getDataCount
      * name:M2-计算数据集计算完成数量(公共)
      * desc:undefined
      * gen by moon at 11/11/2022, 11:59:12 PM
      * 
      **/
     @Trace(operationName = "M2-计算数据集计算完成数量(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public CalculateDataSetCountAchieveNumComRespDto calculateDataSetCountAchieveNumCom(CalculateDataSetCountAchieveNumComReqDto reqDto) {
         CalculateDataSetCountAchieveNumComRespDto retData = new CalculateDataSetCountAchieveNumComRespDto();
         Long completedCount = 0L;
         retData.setCalcCount((long)reqDto.getCountAchieveNumdataSetList().size());
         for(CountAchieveNumdataSetDto one : reqDto.getCountAchieveNumdataSetList()){
             if(one.getIsComplete().equals("TRUE")){
                 completedCount++;
             }

         }
         retData.setAlreadyAccomplishNum(completedCount);
        return retData;
      }
/**
      * code:analyzesAllParaAreEqual
      * name:M2判断条件值相等（特殊方法）
      * desc:undefined
      * gen by moon at 11/13/2022, 4:02:56 PM
      * 
      **/
     @Trace(operationName = "M2判断条件值相等（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public JudgeConditionValueEqualRespDto judgeConditionValueEqual(JudgeConditionValueEqualReqDto reqDto) {
         JudgeConditionValueEqualRespDto retData =  new JudgeConditionValueEqualRespDto();
         retData.setEndValue("1");
         try{
             String baseValue = null;
             Field[] declaredFields = reqDto.getClass().getDeclaredFields();
             for (Field field : declaredFields) {
                 field.setAccessible(true);
                 Object value = field.get(reqDto);
                 String valueTmp = null;
                 if(value==null){
                     continue;
                 }
                 if(field.getType().equals(String.class)){
                     valueTmp = (String)value;
                 }else{
                     valueTmp = String.valueOf((Long)value);
                 }
                 if(baseValue==null){
                     baseValue = valueTmp;
                     continue;
                 }else{
                     if(!baseValue.equals(valueTmp)){
                         retData.setEndValue("0");
                         break;
                     }
                 }
             }
         }catch (Exception e){

         }

        return retData;
      }
/**
      * code:receptionService
      * name:M2-接收字段生命周期操作类型
      * desc:undefined
      * gen by moon at 11/13/2022, 4:03:06 PM
      * 
      **/
     @Trace(operationName = "M2-接收字段生命周期操作类型")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainReceiveFieldsRespDto obtainReceiveFields(ObtainReceiveFieldsReqDto reqDto) {
        return BeanUtil.toBean(reqDto,ObtainReceiveFieldsRespDto.class);
      }
/**
      * code:getLastFromDataList
      * name:M2取排序列表中上一条数据(特殊方法)
      * desc:undefined
      * gen by moon at 11/20/2022, 12:10:33 AM
      * 
      **/
     @Trace(operationName = "M2取排序列表中上一条数据(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryGetLastFromDataListDetailComRespDto queryGetLastFromDataListDetailCom(QueryGetLastFromDataListDetailComReqDto reqDto) {
         QueryGetLastFromDataListDetailComRespDto retData = new QueryGetLastFromDataListDetailComRespDto();
         Long pos = 0L;
         for(GetLastFromDataSpecifiedDto one :reqDto.getGetLastFromDataSpecifiedList()){
             if(reqDto.getCommPrimaryKey().equals(one.getCommPrimaryKey())){
                 break;
             }
             pos++;
         }

         if(reqDto.getOrderSizeType().equals("FROM_LARGE_SMALL")){
             pos = pos +1;
         }else if(reqDto.getOrderSizeType().equals("FROM_SMALL_LARGE")){
             pos = pos -1;
         }

         if(pos<0 || pos > reqDto.getGetLastFromDataSpecifiedList().size()-1){
             return retData;
         }
         retData.setCommPrimaryKey(reqDto.getGetLastFromDataSpecifiedList().get(pos.intValue()).getCommPrimaryKey());
        return retData;
      }
/**
      * code:dataSetSumOfSingleValueComparison
      * name:M2执行数据集数值相加与单数值比较（特殊方法）
      * desc:undefined
      * gen by moon at 11/21/2022, 4:54:27 PM
      *
      **/
     @Trace(operationName = "M2执行数据集数值相加与单数值比较（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetSumOfSingleValueComparisonAssemblyRespDto implementDataSetSumOfSingleValueComparisonAssembly(ImplementDataSetSumOfSingleValueComparisonAssemblyReqDto reqDto) {
         ImplementDataSetSumOfSingleValueComparisonAssemblyRespDto retData = new ImplementDataSetSumOfSingleValueComparisonAssemblyRespDto();
         BigDecimal calcResult = new BigDecimal(0);
         for(Double one : reqDto.getDataSetSumOfSingleValueComparisonList()){
             calcResult = calcResult.add(new BigDecimal(one));
         }
         calcResult = calcResult.setScale(6,BigDecimal.ROUND_HALF_UP);
         BigDecimal target = new BigDecimal(reqDto.getCalcPara2());
         target = target.setScale(6,BigDecimal.ROUND_HALF_UP);
         if(calcResult.compareTo(target)==0){
             retData.setLogicalOperator("EQUAL");
         }else if(calcResult.compareTo(target)<0){
             retData.setLogicalOperator("LESS_THAN");
         }else if(calcResult.compareTo(target)>0){
             retData.setLogicalOperator("GREATER_THAN");
         }
        return retData;
      }


/**
      * code:collectionsMergeData
      * name:M2执行多数据集取并集（特殊方法）
      * desc:undefined
      * gen by moon at 11/29/2022, 9:54:52 AM
      * 
      **/
     @Trace(operationName = "M2执行多数据集取并集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementUnionMultipleDataSetsRespDto implementUnionMultipleDataSets(ImplementUnionMultipleDataSetsReqDto reqDto) {
         ImplementUnionMultipleDataSetsRespDto retData = new ImplementUnionMultipleDataSetsRespDto();
         retData.getUnionMultipleDataSetsList().addAll(reqDto.getDataSetsListOne().stream().map(data->BeanUtil.toBean(data,UnionMultipleDataSetsDto.class)).collect(Collectors.toList()));
         retData.getUnionMultipleDataSetsList().addAll(reqDto.getDataSetsListTwo().stream().map(data->BeanUtil.toBean(data,UnionMultipleDataSetsDto.class)).collect(Collectors.toList()));
        return retData;
      }
/**
      * code:getPublicFieldCache
      * name:M2-获取内存中业务字段（特殊方法）
      * desc:undefined
      * gen by moon at 11/30/2022, 12:36:50 AM
      *
      **/
     @Trace(operationName = "M2-获取内存中业务字段（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainGetPublicFieldCacheRespDto obtainGetPublicFieldCache(ObtainGetPublicFieldCacheReqDto reqDto) {
       // TODO ruizhe skai dong ; 11/30/2022, 12:36:50 AM
        return new ObtainGetPublicFieldCacheRespDto();
      }
/**
      * code:collectionRemoveExistingData
      * name:M2执行两数据集去除已存在（特殊方法）
      * desc:undefined
      * gen by moon at 12/1/2022, 12:30:41 AM
      * 
      **/
     @Trace(operationName = "M2执行两数据集去除已存在（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTwoDataRemovalExistsComRespDto implementTwoDataRemovalExistsCom(ImplementTwoDataRemovalExistsComReqDto reqDto) {
         ImplementTwoDataRemovalExistsComRespDto  retData = new ImplementTwoDataRemovalExistsComRespDto();

         List<String> index = reqDto.getDataSetsListTwo().stream().map(data->data.getCustomField()).collect(Collectors.toList());
         for(DataSetsListOneDto one : reqDto.getDataSetsListOne()){
             if(!index.contains(one.getCustomField())){
                 TwoDataRemovalExistsDto elm = new TwoDataRemovalExistsDto();
                 BeanUtil.copyProperties(one,elm);
                 retData.getTwoDataRemovalExistsList().add(elm);
             }
         }
        return retData;
      }
/**
      * code:findStartTimeOfCurMonAndEndTimeOfNextMon
      * name:M2执行入参时间点获取两个月时间点（特殊方法）
      * desc:undefined
      * gen by moon at 12/1/2022, 12:30:57 AM
      * 
      **/
     @Trace(operationName = "M2执行入参时间点获取两个月时间点（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementGetTwoTimePointsRespDto implementGetTwoTimePoints(ImplementGetTwoTimePointsReqDto reqDto) {
         ImplementGetTwoTimePointsRespDto retData = new ImplementGetTwoTimePointsRespDto();
         Date currentStartTime = DateTimeUtil.getBeginDayOfMonth(reqDto.getComTimeField());
         Date lastMounth = DateTimeUtil.addMonth(currentStartTime,1);
         Date lastMounthEndTime = DateTimeUtil.getEndDayOfMonth(lastMounth);
         retData.setCycleStartTime(currentStartTime);
         retData.setCycleEndTime(lastMounthEndTime);
        return retData;
      }
/**
      * code:matchRecordBySpecRec
      * name:M2执行入参时间匹配记录（特殊方法）
      * desc:undefined
      * gen by moon at 12/1/2022, 12:31:31 AM
      * 
      **/
     @Trace(operationName = "M2执行入参时间匹配记录（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public MatchRecordInputTimePointComRespDto matchRecordInputTimePointCom(MatchRecordInputTimePointComReqDto reqDto) {
         MatchRecordInputTimePointComRespDto retData = new MatchRecordInputTimePointComRespDto();
         MatchRecordInputTimePointDto target = new MatchRecordInputTimePointDto();
         for(MatchRecordInputTimePointDto one : reqDto.getMatchRecordInputTimePointList()){
             if(one.getComTimeField().getTime() == reqDto.getComTimeField().getTime()){
                 target = one;
             }
         }
         BeanUtil.copyProperties(target,retData);
        return retData;
      }
/**
      * code:twoPointTimePeriodDays
      * name:M2执行两点时间段天数（特殊方法）
      * desc:undefined
      * gen by moon at 12/1/2022, 12:31:47 AM
      * 
      **/
     @Trace(operationName = "M2执行两点时间段天数（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public TwoPointTimePeriodDaysComRespDto twoPointTimePeriodDaysCom(TwoPointTimePeriodDaysComReqDto reqDto) {
         TwoPointTimePeriodDaysComRespDto retData = new TwoPointTimePeriodDaysComRespDto();
         if(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()).getTime() == DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()).getTime()){
             retData.setCalcCount(1L);
             return retData;
         }
         List<Date> days = DateTimeUtil.findDates(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()),DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
         if(CollectionUtil.isEmpty(days)){
             days = new ArrayList<>();
         }
         List<Date> fomartDayList = days.stream().map(d -> DateTimeUtil.getDayStartTime(d)).collect(Collectors.toList());
         if(reqDto.getTwoPointTimePeriodType().equals("INCLUDE_BEGIN_DAY")){
             fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
         }else if(reqDto.getTwoPointTimePeriodType().equals("INCLUDE_END_DAY")){
             fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()));
         }else if(reqDto.getTwoPointTimePeriodType().equals("EXCLUSIVE_BEGIN_AND_END_DAYS")){
             if(fomartDayList.size()>2){
                 fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()));
                 fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
             }
         }
         retData.setCalcCount(Long.valueOf(fomartDayList.size()));
        return retData;
      }


/**
      * code:offsetNDaysInTimePointInterval
      * name:M2执行时间点区间内前后偏移N天（特殊方法）
      * desc:undefined
      * gen by moon at 12/1/2022, 12:32:09 AM
      * 
      **/
     @Trace(operationName = "M2执行时间点区间内前后偏移N天（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public OffsetNdaysInTimePointIntervalComRespDto offsetNdaysInTimePointIntervalCom(OffsetNdaysInTimePointIntervalComReqDto reqDto) {
         OffsetNdaysInTimePointIntervalComRespDto retData = new OffsetNdaysInTimePointIntervalComRespDto();
         OffsetNdaysInTimePointIntervalDto target = new OffsetNdaysInTimePointIntervalDto();
         Long count = 0L;
         List<OffsetNdaysInTimePointIntervalDto> filteredList = new ArrayList<>();


         if(reqDto.getNumCompareResult().equals("BEFORE")){
             for(OffsetNdaysInTimePointIntervalDto one : reqDto.getOffsetNdaysInTimePointIntervalList()){
                 if(one.getComTimeField().compareTo(reqDto.getComTimeField())>=0){
                     break;
                 }
                 filteredList.add(one);
             }
             Collections.reverse(filteredList);
             ListIterator<OffsetNdaysInTimePointIntervalDto> itr=filteredList.listIterator();
             while(itr.hasNext()){
                 count++;
                 if(count==reqDto.getComNumField()){
                     target = itr.next();
                     break;
                 }else{
                     itr.next();
                 }
             }

         }else if(reqDto.getNumCompareResult().equals("LATER")){
             boolean bFlag = false;
             for(OffsetNdaysInTimePointIntervalDto one : reqDto.getOffsetNdaysInTimePointIntervalList()){
                 if(one.getComTimeField().compareTo(reqDto.getComTimeField())>=0){
                     bFlag = true;
                 }
                 if(bFlag){
                     filteredList.add(one);
                 }
             }
             ListIterator<OffsetNdaysInTimePointIntervalDto> itr=filteredList.listIterator();
             //置成-1，就是为了让向后找的时候，跳过第一个对象
             count=-1L;
             while(itr.hasNext()){
                 count++;
                 if(count==reqDto.getComNumField()){
                     target = itr.next();
                     break;
                 }else{
                     itr.next();
                 }
             }
         }
         BeanUtil.copyProperties(target,retData);
        return retData;
      }
/**
      * code:analyzeNaturalDayData
      * name:M2执行分析自然日数据集（特殊方法）
      * desc:undefined
      * gen by moon at 12/3/2022, 3:49:49 PM
      *
      **/
     @Trace(operationName = "M2执行分析自然日数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AnalyzeNaturalDayDataComRespDto analyzeNaturalDayDataCom(AnalyzeNaturalDayDataComReqDto reqDto) {
         AnalyzeNaturalDayDataComRespDto retData = new AnalyzeNaturalDayDataComRespDto();
         if(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()).getTime() == DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()).getTime()){
             AnalyzeNaturalDayDataDto oneElm = new AnalyzeNaturalDayDataDto();
             oneElm.setCustomField("1");
             oneElm.setComTimeField1(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()));
             oneElm.setComTimeField2(DateTimeUtil.getDayEndTime(reqDto.getComTimeField2()));
             oneElm.setComTimeField2(CommonFunctionHelper.addDateBySec(oneElm.getComTimeField2(),-1));
             retData.getAnalyzeNaturalDayDataList().add(oneElm);
             return retData;
         }
         List<Date> dayList = DateTimeUtil.findDates(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()),DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
         List<Date> fomartDayList = dayList.stream().map(d -> DateTimeUtil.getDayStartTime(d)).collect(Collectors.toList());
//         两点时间段含头尾类型 INCLUDE_BEGIN_DAY:包含开始当天 INCLUDE_END_DAY:包含结束当天 INCLUDE_BEGIN_AND_END_DAYS:包含开始和结束 EXCLUSIVE_BEGIN_AND_END_DAYS:不包含开始和结束
         if(reqDto.getTwoPointTimePeriodType().equals("INCLUDE_BEGIN_DAY")){
             fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
         }else if(reqDto.getTwoPointTimePeriodType().equals("INCLUDE_END_DAY")){
             fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()));
         }else if(reqDto.getTwoPointTimePeriodType().equals("EXCLUSIVE_BEGIN_AND_END_DAYS")){
             if(fomartDayList.size()>2){
                 fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField1()));
                 fomartDayList.remove(DateTimeUtil.getDayStartTime(reqDto.getComTimeField2()));
             }
         }
         Long count = 0L;
         for(Date one : fomartDayList){
             count++;
             AnalyzeNaturalDayDataDto oneRetData = new AnalyzeNaturalDayDataDto();
             oneRetData.setCustomField(String.valueOf(count));
             oneRetData.setComTimeField1(one);
             oneRetData.setComTimeField2(DateTimeUtil.getDayEndTime(one));
             oneRetData.setComTimeField2(CommonFunctionHelper.addDateBySec(oneRetData.getComTimeField2(),-1));
             retData.getAnalyzeNaturalDayDataList().add(oneRetData);
         }
        return retData;
      }

/**
      * code:getTimeRange
      * name:M2执行计算时间范围服务(公共)
      * desc:undefined
      * gen by moon at 12/6/2022, 7:08:37 PM
      *
      **/
     @Trace(operationName = "M2执行计算时间范围服务(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCountTimeScopeServiceComRespDto implementCountTimeScopeServiceCom(ImplementCountTimeScopeServiceComReqDto reqDto) {
         ImplementCountTimeScopeServiceComRespDto retData = new ImplementCountTimeScopeServiceComRespDto();
         retData.setStartTime(reqDto.getComTimeField1());
         if(reqDto.getCycleTypeCode().equals("YEAR")){
             retData.setEndTime(DateTimeUtil.addMonth(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()*12));
         }else if(reqDto.getCycleTypeCode().equals("HALF_YEAR")){
             retData.setEndTime(DateTimeUtil.addMonth(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()*6));
         }else if(reqDto.getCycleTypeCode().equals("QUARTER")){
             retData.setEndTime(DateTimeUtil.addMonth(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()*3));
         }else if(reqDto.getCycleTypeCode().equals("MONTH")){
             retData.setEndTime(DateTimeUtil.addMonth(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()*1));
         }else if(reqDto.getCycleTypeCode().equals("WEEK")){
             retData.setEndTime(DateTimeUtil.addDay(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()*7));
         }else if(reqDto.getCycleTypeCode().equals("DAY")){
             retData.setEndTime(DateTimeUtil.addDay(reqDto.getComTimeField1(),reqDto.getComNumField().intValue()));
         }

         if(retData.getStartTime()!=null){
             retData.setStartTime(DateTimeUtil.getDayStartTime(retData.getStartTime()));
         }

         if(retData.getEndTime()!=null){
             retData.setEndTime(DateTimeUtil.getDayEndTimeNoPlusOneSec(retData.getEndTime()));
         }
        return retData;
      }
/**
      * code:dataFilterSpecRecBy
      * name:M2执行数据集减一条记录（特殊方法）
      * desc:undefined
      * gen by moon at 12/7/2022, 10:07:21 PM
      *
      **/
     @Trace(operationName = "M2执行数据集减一条记录（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSubtractOneRespDto implementDataSubtractOne(ImplementDataSubtractOneReqDto reqDto) {
         ImplementDataSubtractOneRespDto retData = new ImplementDataSubtractOneRespDto();
         List<String> filteredList = new ArrayList<>(reqDto.getDataSubtractOneList());
         filteredList.remove(reqDto.getCustomField());
         retData.setDataSubtractOneList(filteredList);
        return retData;
      }
/**
      * code:dataFilterSpecRecBy
      * name:M2执行数据集按入参过滤指定记录(公共)
      * desc:undefined
      * gen by moon at 12/16/2022, 5:43:19 PM
      *
      **/
     @Trace(operationName = "M2执行数据集按入参过滤指定记录(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataFilterSpecRecByComRespDto implementDataFilterSpecRecByCom(ImplementDataFilterSpecRecByComReqDto reqDto) {
         ImplementDataFilterSpecRecByComRespDto retData = new ImplementDataFilterSpecRecByComRespDto();
         for(DataFilterSpecRecByDto one : reqDto.getDataFilterSpecRecByList()){
             if(!one.getCustomField().equals(reqDto.getCustomField())){
                 retData.getDataFilterSpecRecByList().add(one);
             }
         }
         return retData;
      }
/**
      * code:numericalSizeComparison
      * name:M2执行两个数值对比大小（特殊方法）
      * desc:undefined
      * gen by moon at 12/30/2022, 5:54:15 PM
      *
      **/
     @Trace(operationName = "M2执行两个数值对比大小（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementNumericalContrastMagnitudeRespDto implementNumericalContrastMagnitude(ImplementNumericalContrastMagnitudeReqDto reqDto) {

         ImplementNumericalContrastMagnitudeRespDto retData = new ImplementNumericalContrastMagnitudeRespDto();
         BigDecimal first = new BigDecimal(reqDto.getCalcPara1());
         first.setScale(6,BigDecimal.ROUND_HALF_UP);
         BigDecimal second = new BigDecimal(reqDto.getCalcPara2());
         second = second.setScale(6,BigDecimal.ROUND_HALF_UP);
         if(first.compareTo(second)>0){
             retData.setNumCompareResult("LATER");
         }else if(first.compareTo(second)==0){
             retData.setNumCompareResult("PRESENT");
         }else if(first.compareTo(second)<0){
             retData.setNumCompareResult("BEFORE");
         }
        return retData;
      }
/**
      * code:dataFilterSpecRecByTypeCode
      * name:M2-执行按类型过滤数据集（特殊方法）
      * desc:undefined
      * gen by moon at 1/3/2023, 7:34:10 PM
      *
      **/
     @Trace(operationName = "M2-执行按类型过滤数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataFilterSpecRecByTypeCodeRespDto implementDataFilterSpecRecByTypeCode(ImplementDataFilterSpecRecByTypeCodeReqDto reqDto) {
         ImplementDataFilterSpecRecByTypeCodeRespDto retData = new ImplementDataFilterSpecRecByTypeCodeRespDto();
         for(DataFilterSpecRecByTypeCodeDto one : reqDto.getDataFilterSpecRecByTypeCodeList()){
             if(one.getComCode().equals(reqDto.getComCode())){
                 retData.getDataFilterSpecRecByTypeCodeList().add(one);
             }
         }
        return retData;
      }
/**
      * code:gainIssueState
      * name:M2执行获取上级非末级的下发状态(公共)
      * desc:undefined
      * gen by moon at 1/10/2023, 9:17:17 PM
      *
      **/
     @Trace(operationName = "M2执行获取上级非末级的下发状态(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementGainSuperiorNotLastIssueStateComRespDto implementGainSuperiorNotLastIssueStateCom(ImplementGainSuperiorNotLastIssueStateComReqDto reqDto) {
         ImplementGainSuperiorNotLastIssueStateComRespDto retData = new ImplementGainSuperiorNotLastIssueStateComRespDto();
         Map<String,List<SubordinateTargetObjAssistNodeStatusDto>> index = new HashMap<>();
         for(SubordinateTargetObjAssistNodeStatusDto subSource : reqDto.getSubordinateTargetObjAssistNodeStatusList()){
             if(index.containsKey(subSource.getCustomField1())){
                 index.get(subSource.getCustomField1()).add(subSource);
             }else{
                 List<SubordinateTargetObjAssistNodeStatusDto> subList = new ArrayList<>();
                 subList.add(subSource);
                 index.put(subSource.getCustomField1(),subList);
             }
             TargetContGainIssueStateDto elm = new TargetContGainIssueStateDto();
             elm.setComTxtField(subSource.getComTxtField());
             elm.setCustomField(subSource.getCustomField());
             retData.getTargetContGainIssueStateList().add(elm);
         }

         for(SuperiorTargetObjAssistNodeStatusListDto parentSource : reqDto.getSuperiorTargetObjAssistNodeStatusListList()){
             if(!index.containsKey(parentSource.getCustomField1())){
                 TargetContGainIssueStateDto elm = new TargetContGainIssueStateDto();
                 elm.setCustomField(parentSource.getCustomField());
                 elm.setComTxtField("FALSE");
                 retData.getTargetContGainIssueStateList().add(elm);
                 continue;
             }

             if(index.containsKey(parentSource.getCustomField1())){
                 List<SubordinateTargetObjAssistNodeStatusDto> subList = index.get(parentSource.getCustomField1());
                 TargetContGainIssueStateDto elm = new TargetContGainIssueStateDto();
                 elm.setCustomField(parentSource.getCustomField());
                 elm.setComTxtField("TRUE");
                 for(SubordinateTargetObjAssistNodeStatusDto oneSub : subList){
                     if(oneSub.getComTxtField().equals("FALSE")){
                         elm.setComTxtField("FALSE");
                         break;
                     }
                 }
                 retData.getTargetContGainIssueStateList().add(elm);
                 continue;
             }
         }
        return retData;
      }
/**
      * code:collectionsMergeData
      * name:M2执行多数据集多字段取并集（特殊方法）
      * desc:undefined
      * gen by moon at 1/11/2023, 3:15:24 AM
      * 
      **/
     @Trace(operationName = "M2执行多数据集多字段取并集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementUnionMultipleManyFieldsDataSetsRespDto implementUnionMultipleManyFieldsDataSets(ImplementUnionMultipleManyFieldsDataSetsReqDto reqDto) {
         ImplementUnionMultipleManyFieldsDataSetsRespDto retData = new ImplementUnionMultipleManyFieldsDataSetsRespDto();
         retData.getUnionMultipleDataSetsList().addAll(reqDto.getDataSetsListOne().stream().map(data->BeanUtil.toBean(data,UnionMultipleDataSetsDto.class)).collect(Collectors.toList()));
         retData.getUnionMultipleDataSetsList().addAll(reqDto.getDataSetsListTwo().stream().map(data->BeanUtil.toBean(data,UnionMultipleDataSetsDto.class)).collect(Collectors.toList()));
         return retData;
      }
/**
      * code:singleDatasetObjMerge
      * name:M2执行获取非分工目标内容下发状态
      * desc:undefined
      * gen by moon at 1/11/2023, 3:15:49 AM
      * 
      **/
     @Trace(operationName = "M2执行获取非分工目标内容下发状态")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementGainNotDivTargetContIssueStateRespDto implementGainNotDivTargetContIssueState(ImplementGainNotDivTargetContIssueStateReqDto reqDto) {
         ImplementGainNotDivTargetContIssueStateRespDto retData = new ImplementGainNotDivTargetContIssueStateRespDto();
         for(String one : reqDto.getSuperiorTargetObjAssistNodeStatusListList()){
             TargetContGainIssueStateDto elm = new TargetContGainIssueStateDto();
             elm.setCustomField(one);
             elm.setComTxtField(reqDto.getComTxtField());
             retData.getTargetContGainIssueStateList().add(elm);
         }
        return retData;
      }
/**
      * code:collectionsIntersectionsData
      * name:M2执行多数据集多字段取交集（特殊方法）
      * desc:undefined
      * gen by moon at 1/12/2023, 3:17:11 AM
      *
      **/
     @Trace(operationName = "M2执行多数据集多字段取交集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementUniteMultipleManyFieldsDataSetsRespDto implementUniteMultipleManyFieldsDataSets(ImplementUniteMultipleManyFieldsDataSetsReqDto reqDto) {
         ImplementUniteMultipleManyFieldsDataSetsRespDto retData = new ImplementUniteMultipleManyFieldsDataSetsRespDto();

         for(DataSetsListTwoDto one :reqDto.getDataSetsListTwo()){
             for(DataSetsListOneDto subone : reqDto.getDataSetsListOne()){
                 if(one.getCustomField().equals(subone.getCustomField())){
                     retData.getCollectionsIntersectionsDataList().add(BeanUtil.toBean(subone,CollectionsIntersectionsDataDto.class));
                 }
             }
         }
        return retData;
      }
/**
      * code:columnToRow
      * name:M2执行数据集单条多字段列转行(特殊方法）
      * desc:undefined
      * gen by moon at 1/17/2023, 8:16:54 PM
      *
      **/
     @Trace(operationName = "M2执行数据集单条多字段列转行(特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataEinzelbandFiltersColumnTurnRowRespDto implementDataEinzelbandFiltersColumnTurnRow(ImplementDataEinzelbandFiltersColumnTurnRowReqDto reqDto) {
         ImplementDataEinzelbandFiltersColumnTurnRowRespDto retData = new ImplementDataEinzelbandFiltersColumnTurnRowRespDto();
         if (CollectionUtil.isNotEmpty(reqDto.getDataEinzelbandFiltersColumnTurnRowList())) {
             DataEinzelbandFiltersColumnTurnRowDto one = reqDto.getDataEinzelbandFiltersColumnTurnRowList().get(0);
             BeanUtil.copyProperties(one,retData);
         }
        return retData;
      }
/**
      * code:dataAuClassification
      * name:M2执行数据新增删除分类（特殊方法）
      * desc:undefined
      * gen by moon at 1/18/2023, 2:00:44 PM
      *
      **/
     @Trace(operationName = "M2执行数据新增删除分类（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataAddOrDeleteClassRespDto implementDataAddOrDeleteClass(ImplementDataAddOrDeleteClassReqDto reqDto) {
         ImplementDataAddOrDeleteClassRespDto retData = new ImplementDataAddOrDeleteClassRespDto();
         for(String one : reqDto.getDataSetsListOne()){
             if(reqDto.getDataSetsListTwo().contains(one)){
                 retData.getAwaitAddClassDataList().add(one);
             }else{
                 retData.getAwaitDeleteClassDataList().add(one);
             }
         }

        return retData;
      }
/**
      * code:stringEfficiencyCheck
      * name:M2-执行字符串对比（特殊方法）
      * desc:undefined
      * gen by moon at 1/23/2023, 2:45:09 AM
      *
      **/
     @Trace(operationName = "M2-执行字符串对比（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementStringEfficiencyCheckRespDto implementStringEfficiencyCheck(ImplementStringEfficiencyCheckReqDto reqDto) {
         ImplementStringEfficiencyCheckRespDto retData = new ImplementStringEfficiencyCheckRespDto();
         retData.setStringEfficiencyCheckResult("FALSE");
         if(reqDto.getComparisonString()!=null && reqDto.getReferenceString()!=null){
             if(reqDto.getReferenceString().equals(reqDto.getComparisonString())){
                 retData.setStringEfficiencyCheckResult("TRUE");
             }
         }
        return retData;
      }
/**
      * code:objectToData
      * name:M2-执行多字段转数据集（特殊方法）
      * desc:undefined
      * gen by moon at 2/8/2023, 1:47:41 PM
      *
      **/
     @Trace(operationName = "M2-执行多字段转数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementMulitDataToOneDatasRespDto implementMulitDataToOneDatas(ImplementMulitDataToOneDatasReqDto reqDto) {
         ImplementMulitDataToOneDatasRespDto retData =  new ImplementMulitDataToOneDatasRespDto();
         MulitDataToOneDatasDto data1 = new MulitDataToOneDatasDto();
         MulitDataToOneDatasDto data2 = new MulitDataToOneDatasDto();
         MulitDataToOneDatasDto data3 = new MulitDataToOneDatasDto();
         data1.setCustomField1(reqDto.getCustomField());
         data1.setCustomField2(reqDto.getCustomField1());

         data2.setCustomField1(reqDto.getCustomField2());
         data2.setCustomField2(reqDto.getCustomField3());

         data3.setCustomField1(reqDto.getCustomField4());
         data3.setCustomField2(reqDto.getCustomField5());

         if(StrUtil.isNotEmpty(data1.getCustomField1()) && StrUtil.isNotEmpty(data1.getCustomField2())){
             retData.getMulitDataToOneDatasList().add(data1);
         }
         if(StrUtil.isNotEmpty(data2.getCustomField1()) && StrUtil.isNotEmpty(data2.getCustomField2())){
             retData.getMulitDataToOneDatasList().add(data2);
         }
         if(StrUtil.isNotEmpty(data3.getCustomField1()) && StrUtil.isNotEmpty(data3.getCustomField2())){
             retData.getMulitDataToOneDatasList().add(data3);
         }
        return retData;
      }
/**
      * code:SPLIT_DATA_BY_CONDITION
      * name:M2执行根据排序左右切数据（特殊方法）
      * desc:undefined
      * gen by moon at 2/8/2023, 1:48:03 PM
      *
      **/
     @Trace(operationName = "M2执行根据排序左右切数据（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementSplitDataBySortRespDto implementSplitDataBySort(ImplementSplitDataBySortReqDto reqDto) {
         ImplementSplitDataBySortRespDto retData = new ImplementSplitDataBySortRespDto();
         List<ComDatasDto> targetList = new ArrayList<>();
         for(ComDatasDto one : reqDto.getComDatasList()){
             if(one.getCustomField2()==null){
                 continue;
             }
             if(reqDto.getCustomField1().equals("FIND_BIG_DATA")){
                 if(Double.valueOf(one.getCustomField2()).doubleValue() > Double.valueOf(reqDto.getCustomField2()).doubleValue()){
                     targetList.add(one);
                 }else{
                     continue;
                 }
             }else{
                 if(Double.valueOf(one.getCustomField2()).doubleValue() < Double.valueOf(reqDto.getCustomField2()).doubleValue()){
                     targetList.add(one);
                 }else{
                     continue;
                 }
             }
         }
         retData.setComDatasList(targetList);
         return retData;
      }
/**
      * code:cutString
      * name:M2截取字符串保留前N个字符（特殊方法）
      * desc:undefined
      * gen by moon at 2/9/2023, 5:57:46 PM
      *
      **/
     @Trace(operationName = "M2截取字符串保留前N个字符（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryCutRetainStringDetailRespDto queryCutRetainStringDetail(QueryCutRetainStringDetailReqDto reqDto) {
         QueryCutRetainStringDetailRespDto retData = new QueryCutRetainStringDetailRespDto();
         if(reqDto.getOriginalString()!=null && reqDto.getOriginalString().length()<=reqDto.getComNumField().intValue()){
             retData.setCutString(reqDto.getOriginalString());
             return retData;
         }
         retData.setCutString(reqDto.getOriginalString().substring(0,reqDto.getComNumField().intValue()));
        return retData;
      }
/**
      * code:objectToData
      * name:M2执行多条转数据集（特殊方法）
      * desc:undefined
      * gen by moon at 2/23/2023, 6:33:22 PM
      *
      **/
     @Trace(operationName = "M2执行多条转数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementMutDataToOneDatasRespDto implementMutDataToOneDatas(ImplementMutDataToOneDatasReqDto reqDto) {
         ImplementMutDataToOneDatasRespDto retData = new ImplementMutDataToOneDatasRespDto();
         if(reqDto.getCustomField1()!=null){
             retData.getComDatasList().add(reqDto.getCustomField1());
         }

         if(reqDto.getCustomField2()!=null){
             retData.getComDatasList().add(reqDto.getCustomField2());
         }

         if(reqDto.getCustomField3()!=null){
             retData.getComDatasList().add(reqDto.getCustomField3());
         }

         if(reqDto.getCustomField4()!=null){
             retData.getComDatasList().add(reqDto.getCustomField4());
         }

         if(reqDto.getCustomField5()!=null){
             retData.getComDatasList().add(reqDto.getCustomField5());
         }

         if(reqDto.getCustomField6()!=null){
             retData.getComDatasList().add(reqDto.getCustomField6());
         }

         if(reqDto.getCustomField7()!=null){
             retData.getComDatasList().add(reqDto.getCustomField7());
         }

         if(reqDto.getCustomField8()!=null){
             retData.getComDatasList().add(reqDto.getCustomField8());
         }

         if(reqDto.getCustomField()!=null){
             retData.getComDatasList().add(reqDto.getCustomField());
         }
        return retData;
      }
/**
      * code:docDataSetInsertionOrderNum
      * name:M2执行文档数据集插入排序字段
      * desc:undefined
      * gen by moon at 3/11/2023, 3:34:02 PM
      * 
      **/
     @Trace(operationName = "M2执行文档数据集插入排序字段")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDocDataSetInsertionOrderNumRespDto implementDocDataSetInsertionOrderNum(ImplementDocDataSetInsertionOrderNumReqDto reqDto) {
         ImplementDocDataSetInsertionOrderNumRespDto retData = new ImplementDocDataSetInsertionOrderNumRespDto();
         Long orderNumCount =1L;
         for(DocumentDto one : reqDto.getDocumentList()){
             one.setOrderNumber(orderNumCount);
             orderNumCount++;
             retData.getDocumentList().add(one);
         }
        return retData;
      }
/**
      * code:dataSetMergeDocRelationFields
      * name:M2执行数据集合并文档关系字段(公共)
      * desc:undefined
      * gen by moon at 3/11/2023, 3:34:24 PM
      * 
      **/
     @Trace(operationName = "M2执行数据集合并文档关系字段(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetMergeDocRelationFieldsComRespDto implementDataSetMergeDocRelationFieldsCom(ImplementDataSetMergeDocRelationFieldsComReqDto reqDto) {
         ImplementDataSetMergeDocRelationFieldsComRespDto retData = new ImplementDataSetMergeDocRelationFieldsComRespDto();
         Map<String,DataSetsListOneDto> indexInfo = new HashMap<>();
         for(DataSetsListOneDto one : reqDto.getDataSetsListOne()){
             indexInfo.put(one.getUnstructuredDataId(),one);
         }
         for(DocumentDto one : reqDto.getDocumentList()){
             if(indexInfo.containsKey(one.getUnstructuredDataId())){
                 DataSetsListOneDto secondObj = indexInfo.get(one.getUnstructuredDataId());
                 one.setIsNetworkReference(secondObj.getIsNetworkReference());
                 one.setSourceRelationshipId(secondObj.getSourceRelationshipId());
             }
             retData.getDocumentList().add(one);
         }
         return retData;
      }
/**
      * code:DATA_LIST_ALL_PATH
      * name:M2-执行数据集文件地址输出全路径（特殊模式）
      * desc:undefined
      * gen by moon at 3/30/2023, 12:34:02 PM
      *
      **/
     @Trace(operationName = "M2-执行数据集文件地址输出全路径（特殊模式）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataListAllPathRespDto implementDataListAllPath(ImplementDataListAllPathReqDto reqDto) {
         ImplementDataListAllPathRespDto retData = new ImplementDataListAllPathRespDto();
         retData.setDataListAllPathList(reqDto.getDataListAllPathList().stream().filter(d->d.getCustomField1()!=null && !d.getCustomField1().equals("--")).map(d->{
             DataListAllPathDto elm = new DataListAllPathDto();
             elm.setCustomField(d.getCustomField());
             elm.setCustomField1(CommonFunctionHelper.getFilePath(d.getCustomField1()));
             return elm;
         }).collect(Collectors.toList()));
        return retData;
      }
/**
      * code:manyDataSetFieldsMerge
      * name:M2执行多数据集字段合并（特殊方法）
      * desc:undefined
      * gen by moon at 4/2/2023, 9:50:54 PM
      * 
      **/
     @Trace(operationName = "M2执行多数据集字段合并（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementManyDataSetFieldsMergeRespDto implementManyDataSetFieldsMerge(ImplementManyDataSetFieldsMergeReqDto reqDto) {
         ImplementManyDataSetFieldsMergeRespDto retData = new ImplementManyDataSetFieldsMergeRespDto();
         Map<String,DataSetsListTwoDto> index = new HashMap<>();
         for(DataSetsListTwoDto one : reqDto.getDataSetsListTwo()){
             index.put(one.getCustomField(),one);
         }

         for(DataSetsListOneDto one : reqDto.getDataSetsListOne()){

             MergeFieldsDto elm = new MergeFieldsDto();
             elm.setCustomField(one.getCustomField());
             elm.setCustomField1(one.getCustomField1());
             elm.setCustomField2(one.getCustomField2());
             elm.setCustomField3(one.getCustomField3());
             elm.setCustomField4(one.getCustomField4());
             if(index.containsKey(one.getCustomField())){
                 DataSetsListTwoDto sub = index.get(one.getCustomField());
                 elm.setCustomField5(sub.getCustomField5());
                 elm.setCustomField6(sub.getCustomField6());
                 elm.setCustomField7(sub.getCustomField7());
                 elm.setCustomField8(sub.getCustomField8());
             }
             retData.getMergeFieldsList().add(elm);
         }
        return retData;
      }
/**
      * code:timeTurnToString
      * name:M2-执行标准时间转换为字符串（特殊接口）
      * desc:undefined
      * gen by moon at 4/15/2023, 1:05:16 AM
      * 
      **/
     @Trace(operationName = "M2-执行标准时间转换为字符串（特殊接口）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTimeTurnToStringRespDto implementTimeTurnToString(ImplementTimeTurnToStringReqDto reqDto) {
         ImplementTimeTurnToStringRespDto retData = new ImplementTimeTurnToStringRespDto();
         if(reqDto.getComTimeField()!=null){
             retData.setComTxtField(DateTimeUtil.dateFormat2(reqDto.getComTimeField()));
         }
        return retData;
      }
/**
      * code:findAllLevelCodeList
      * name:M2-查找祖先标识列表(特殊方法）
      * desc:undefined
      * gen by moon at 4/17/2023, 11:49:39 PM
      *
      **/
     @Trace(operationName = "M2-查找祖先标识列表(特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryLookAncestorNodeCodeListRespDto queryLookAncestorNodeCodeList(QueryLookAncestorNodeCodeListReqDto reqDto) {
         QueryLookAncestorNodeCodeListRespDto retData = new QueryLookAncestorNodeCodeListRespDto();
         String oriCode = null;

         if(reqDto.getComCode()!=null && !reqDto.getComCode().isEmpty()){
             oriCode = reqDto.getComCode();
         }

         if(oriCode==null || oriCode.isEmpty()){
             return retData;
         }
         int dealSize = 4;
         while(oriCode.length() >= dealSize){
             String oneCode = oriCode.substring(0,dealSize);
             if(oneCode!=null && !oneCode.isEmpty()){
                 retData.getLookAncestorNodeList().add(oneCode);
             }
             dealSize = dealSize + 4;
         }
         retData.getLookAncestorNodeList().remove(oriCode);
         Collections.reverse(retData.getLookAncestorNodeList());
         return retData;


      }
/**
      * code:twoValuesIsEquality
      * name:M2执行两个值比较是否相等(特殊方法）
      * desc:undefined
      * gen by moon at 5/3/2023, 2:38:19 PM
      * 
      **/
     @Trace(operationName = "M2执行两个值比较是否相等(特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTwoValuesIsEqualityRespDto implementTwoValuesIsEquality(ImplementTwoValuesIsEqualityReqDto reqDto) {
         ImplementTwoValuesIsEqualityRespDto retData = new ImplementTwoValuesIsEqualityRespDto();
         if(reqDto.getCustomField().equals(reqDto.getCustomField1())){
             retData.setTureOrFalse("TRUE");
         }else{
             retData.setTureOrFalse("FALSE");
         }
        return retData;
      }
/**
      * code:manyDataSetFieldsMerge
      * name:M2-执行周期合并（特殊方法）
      * desc:undefined
      * gen by moon at 5/7/2023, 7:18:55 PM
      *
      **/
     @Trace(operationName = "M2-执行周期合并（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementExcCycleSetFieldsMergeRespDto implementExcCycleSetFieldsMerge(ImplementExcCycleSetFieldsMergeReqDto reqDto) {
         ImplementExcCycleSetFieldsMergeRespDto retData = new ImplementExcCycleSetFieldsMergeRespDto();
         retData.getExecuteCycleStageList().addAll(reqDto.getExecuteCycleStageList().stream().map(data->BeanUtil.toBean(data,ExecuteCycleStageDto.class)).collect(Collectors.toList()));
         retData.getExecuteCycleStageList().addAll(reqDto.getExcCycleSetFieldsMergeList().stream().map(data->BeanUtil.toBean(data,ExecuteCycleStageDto.class)).collect(Collectors.toList()));
         return retData;
      }
/**
      * code:receptionService
      * name:M2执行接收数据集出参（特殊方法）
      * desc:undefined
      * gen by moon at 5/8/2023, 6:02:23 AM
      *
      **/
     @Trace(operationName = "M2执行接收数据集出参（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementAcceptDataSetOutputRespDto implementAcceptDataSetOutput(ImplementAcceptDataSetOutputReqDto reqDto) {
        return BeanUtil.toBean(reqDto,ImplementAcceptDataSetOutputRespDto.class);
      }
/**
      * code:getCurrentContentCode
      * name:M2获取输出当前标识
      * desc:undefined
      * gen by moon at 5/16/2023, 8:56:32 PM
      *
      **/
     @Trace(operationName = "M2获取输出当前标识")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainOutPutCurrentCodeRespDto obtainOutPutCurrentCode(ObtainOutPutCurrentCodeReqDto reqDto) {
         return BeanUtil.toBean(reqDto,ObtainOutPutCurrentCodeRespDto.class);
      }
/**
      * code:findStartTimeOfCurMonAndEndTimeOfForwardMon
      * name:M2-执行入参时间点获取当前及前一个月时间点（特殊方法）
      * desc:undefined
      * gen by moon at 5/27/2023, 9:40:28 PM
      * 
      **/
     @Trace(operationName = "M2-执行入参时间点获取当前及前一个月时间点（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementInputTimePointGetForwordTwoTimePointsRespDto implementInputTimePointGetForwordTwoTimePoints(ImplementInputTimePointGetForwordTwoTimePointsReqDto reqDto) {
         ImplementInputTimePointGetForwordTwoTimePointsRespDto retData = new ImplementInputTimePointGetForwordTwoTimePointsRespDto();
         retData.setCycleEndTime(DateTimeUtil.getEndDayOfMonth(reqDto.getComTimeField()));
         Date lastMounth = DateTimeUtil.addMonth(reqDto.getComTimeField(),-1);
         retData.setCycleStartTime(DateTimeUtil.getBeginDayOfMonth(lastMounth));
        return retData;
      }
/**
      * code:calcDoubleWeekByTimeRange
      * name:M2-执根据开始结束时间计算双周（特殊方法）
      * desc:undefined
      * gen by moon at 5/28/2023, 12:29:10 AM
      * 
      **/
     @Trace(operationName = "M2-执根据开始结束时间计算双周（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCalcDoubleWeekByTimeRangeRespDto implementCalcDoubleWeekByTimeRange(ImplementCalcDoubleWeekByTimeRangeReqDto reqDto) {
         if(reqDto.getCycleIsCutHeadAndTail()!=null && reqDto.getCycleIsCutHeadAndTail().equals("TRUE")){
             ImplementCalcDoubleWeekByTimeRangeRespDto retData = new ImplementCalcDoubleWeekByTimeRangeRespDto();
             Long index = 0L;
             Date frontCursor = reqDto.getComTimeField();
             Date backCursor = DateTimeUtil.addDay(frontCursor,13);
             backCursor = DateTimeUtil.getDayEndTime99(backCursor);
             while(backCursor.compareTo(reqDto.getCycleEndTime())<0){
                 index++;
                 Long endStr = index*2;
                 Long startStr = endStr-1;
                 DoubleWeekDto elm = new DoubleWeekDto();
                 elm.setCycleStartTime(frontCursor);
                 elm.setCycleEndTime(backCursor);
                 elm.setCycleTypeCode("DOUBLE_WEEKS");
                 elm.setCycleStandardName("第"+startStr+"-"+endStr+"双周");
                 elm.setOrderNumber(CommonFunctionHelper.getDateTimeOrderNum(elm.getCycleStartTime(),elm.getCycleEndTime()));
                 retData.getDoubleWeekList().add(elm);
                 frontCursor = DateTimeUtil.addSecond(backCursor,1);
                 backCursor = DateTimeUtil.addDay(frontCursor,13);
                 backCursor = DateTimeUtil.getDayEndTime99(backCursor);

             }

             index++;
             Long endStr = index*2;
             Long startStr = endStr-1;
             DoubleWeekDto elm = new DoubleWeekDto();
             elm.setCycleStartTime(frontCursor);
             elm.setCycleEndTime(reqDto.getCycleEndTime());
             elm.setCycleTypeCode("DOUBLE_WEEKS");
             elm.setCycleStandardName("第"+startStr+"-"+endStr+"双周");
             elm.setOrderNumber(CommonFunctionHelper.getDateTimeOrderNum(elm.getCycleStartTime(),elm.getCycleEndTime()));
             retData.getDoubleWeekList().add(elm);

             if(CollectionUtil.isNotEmpty(retData.getDoubleWeekList())){
                 retData.getDoubleWeekList().get(0).setCycleStartTime(reqDto.getCycleStartTime());
             }
             return retData;
         }else{
             ImplementCalcDoubleWeekByTimeRangeRespDto retData = new ImplementCalcDoubleWeekByTimeRangeRespDto();
             Long index = 0L;
             Date frontCursor = reqDto.getComTimeField();
             Date backCursor = DateTimeUtil.addDay(frontCursor,13);
             backCursor = DateTimeUtil.getDayEndTime99(backCursor);
             while(backCursor.compareTo(reqDto.getCycleEndTime())<0){
                 index++;
                 Long endStr = index*2;
                 Long startStr = endStr-1;
                 DoubleWeekDto elm = new DoubleWeekDto();
                 elm.setCycleStartTime(frontCursor);
                 elm.setCycleEndTime(backCursor);
                 elm.setCycleTypeCode("DOUBLE_WEEKS");
                 elm.setCycleStandardName("第"+startStr+"-"+endStr+"双周");
                 elm.setOrderNumber(CommonFunctionHelper.getDateTimeOrderNum(elm.getCycleStartTime(),elm.getCycleEndTime()));
                 retData.getDoubleWeekList().add(elm);
                 frontCursor = DateTimeUtil.addSecond(backCursor,1);
                 backCursor = DateTimeUtil.addDay(frontCursor,13);
                 backCursor = DateTimeUtil.getDayEndTime99(backCursor);

             }

             index++;
             Long endStr = index*2;
             Long startStr = endStr-1;
             DoubleWeekDto elm = new DoubleWeekDto();
             elm.setCycleStartTime(frontCursor);
             elm.setCycleEndTime(backCursor);
             elm.setCycleTypeCode("DOUBLE_WEEKS");
             elm.setCycleStandardName("第"+startStr+"-"+endStr+"双周");
             elm.setOrderNumber(CommonFunctionHelper.getDateTimeOrderNum(elm.getCycleStartTime(),elm.getCycleEndTime()));
             retData.getDoubleWeekList().add(elm);

             return retData;
         }

      }
/**
      * code:cleaningPhysicalFiles
      * name:M2执行清洗物理文件(特殊方法)
      * desc:undefined
      * gen by moon at 6/11/2023, 8:54:02 PM
      *
      **/
     @Trace(operationName = "M2执行清洗物理文件(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCleaningPhysicalFilesRespDto implementCleaningPhysicalFiles(ImplementCleaningPhysicalFilesReqDto reqDto) {
       // TODO ruizhe skai dong ; 6/11/2023, 8:54:02 PM
        return new ImplementCleaningPhysicalFilesRespDto();
      }
/**
      * code:getCollectionsDiff
      * name:M2执行数据集差集
      * desc:undefined
      * gen by moon at 6/12/2023, 11:21:27 AM
      * 
      **/
     @Trace(operationName = "M2执行数据集差集")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCollectionsDiffRespDto implementCollectionsDiff(ImplementCollectionsDiffReqDto reqDto) {
         ImplementCollectionsDiffRespDto retData =  new ImplementCollectionsDiffRespDto();
         for(String one : reqDto.getCollectionsDiffComFatList()){
             if(!reqDto.getCollectionsDiffComSubList().contains(one)){
                 retData.getCollectionsDiffList().add(one);
             }
         }
        return retData;
      }
/**
      * code:dataSetRemoveNullData
      * name:M2执行数据集去除空值数据（特殊方法）
      * desc:undefined
      * gen by moon at 6/27/2023, 1:12:20 PM
      *
      **/
     @Trace(operationName = "M2执行数据集去除空值数据（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataSetRemoveNullDataRespDto implementDataSetRemoveNullData(ImplementDataSetRemoveNullDataReqDto reqDto) {
         ImplementDataSetRemoveNullDataRespDto retData = new ImplementDataSetRemoveNullDataRespDto();
         for(DataSetRemoveNullDataDto one : reqDto.getDataSetRemoveNullDataList()){
             if(one.getComFloatField()!=null){
                 retData.getDataSetRemoveNullDataList().add(one.getCommPrimaryKey());
             }
         }
        return retData;
      }
/**
      * code:dataStochasticOne
      * name:M2获取数据集随机一条记录（特殊方法）
      * desc:undefined
      * gen by moon at 6/28/2023, 1:03:00 AM
      * 
      **/
     @Trace(operationName = "M2获取数据集随机一条记录（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainDataStochasticOneRespDto obtainDataStochasticOne(ObtainDataStochasticOneReqDto reqDto) {
         ObtainDataStochasticOneRespDto retData = new ObtainDataStochasticOneRespDto();
         if(CollectionUtil.isNotEmpty(reqDto.getDataStochasticOneList())){
             Random random = new Random();
             int randomNumber = random.nextInt(reqDto.getDataStochasticOneList().size()); // 生成0到10的随机整数
             retData.setCustomField(reqDto.getDataStochasticOneList().get(randomNumber));
         }
         return retData;
      }
/**
      * code:collectionRemoveDuplicateData
      * name:M2执行多字段数据集记录去重（特殊方法）
      * desc:undefined
      * gen by moon at 8/1/2023, 9:13:36 PM
      *
      **/
     @Trace(operationName = "M2执行多字段数据集记录去重（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementManyFieldsDataSetDuplicateRemovalRespDto implementManyFieldsDataSetDuplicateRemoval(ImplementManyFieldsDataSetDuplicateRemovalReqDto reqDto) {
         ImplementManyFieldsDataSetDuplicateRemovalRespDto retData = new ImplementManyFieldsDataSetDuplicateRemovalRespDto();
         List<String> keyList = new ArrayList<>();
         for(DataSetDuplicateRemovalDto one : reqDto.getDataSetDuplicateRemovalList()){
             if(!keyList.contains(one.getCommPrimaryKey())){
                 keyList.add(one.getCommPrimaryKey());
                 retData.getDataSetDuplicateRemovalList().add(one);
             }
         }
         return retData;
      }
/**
      * code:timeAddAndSub
      * name:M2-执行时间加减操作
      * desc:undefined
      * gen by moon at 8/15/2023, 8:35:37 PM
      *
      **/
     @Trace(operationName = "M2-执行时间加减操作")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTimeAddAndSubRespDto implementTimeAddAndSub(ImplementTimeAddAndSubReqDto reqDto) {
         ImplementTimeAddAndSubRespDto retData = new ImplementTimeAddAndSubRespDto();
         Long timeNum = 0L;
         //时间单位类型 DAY:天 HOUR:小时 MINUTES:分钟 SECOND:秒
         if(reqDto.getTimeUnitType().equals("DAY")){
             timeNum = reqDto.getComNumField()*24*3600;
         }else if(reqDto.getTimeUnitType().equals("HOUR")){
             timeNum = reqDto.getComNumField()*3600;
         }else if(reqDto.getTimeUnitType().equals("MINUTES")){
             timeNum = reqDto.getComNumField()*60;
         }else if(reqDto.getTimeUnitType().equals("SECOND")){
             timeNum = reqDto.getComNumField();
         }
         //通用计算公式 ADDITION_OF_TWO_NUM:两个数相加 SUBTRACTION_OF_TWO_NUM:两个数相减 DIVISION_OF_TWO_NUM:两个数相除 SUM_OF_MULTIPLE_NUM:数据集求和 RATIO_BETWEEN_TWO_NUM:两个数差额比 RATIO_OF_TWO_NUM:两个数数值比 COMPLEX_CALC_OF_MULTIPLE_NUM:数据集复合计算 NEWEST_OF_MULTIPLE_NUM:数据集取最新 MAX_OR_MIN_OF_MULTIPLE_NUM:数据集求最大最小值 AVERAGE_OF_MULTIPLE_NUM:数据集求平均值 PART_AVE_OF_MULTIPLE_NUM:数据集去除最大最小求平均 COMPLEX_CALC_OF_TWO_NUM:两个数复合计算 MULTI_OF_TWO_NUM:两个数相乘

         if(reqDto.getCalcFormula().equals("ADDITION_OF_TWO_NUM")){
             retData.setCalcTimeResult(DateTimeUtil.addSecond(reqDto.getComTimeField(),timeNum.intValue()));
         }else if(reqDto.getCalcFormula().equals("SUBTRACTION_OF_TWO_NUM")){
             retData.setCalcTimeResult(DateTimeUtil.addSecond(reqDto.getComTimeField(),timeNum.intValue()*-1));
         }
        return retData;
      }
/**
      * code:comparisonOfMultipleTimeTypes
      * name:M2-执行多时间类型对比（特殊方法）
      * desc:undefined
      * gen by moon at 9/3/2023, 8:28:56 PM
      * 
      **/
     @Trace(operationName = "M2-执行多时间类型对比（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementComparisonOfMultipleTimeTypesRespDto implementComparisonOfMultipleTimeTypes(ImplementComparisonOfMultipleTimeTypesReqDto reqDto) {
         ImplementComparisonOfMultipleTimeTypesRespDto retData = new ImplementComparisonOfMultipleTimeTypesRespDto();

         Date date1 = reqDto.getCompareTime();
         Date date2 = reqDto.getCaluStartTime();

         Instant instant = date1.toInstant();
         ZoneId zone = ZoneId.systemDefault();
         LocalDateTime localDateTime1 = LocalDateTime.ofInstant(instant, zone);

         Instant instant2 = date2.toInstant();
         LocalDateTime localDateTime2 = LocalDateTime.ofInstant(instant2, zone);
         long yearsDiff = ChronoUnit.YEARS.between(localDateTime2.withMonth(1).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0),localDateTime1.withMonth(1).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0));
         long monthsDiff = ChronoUnit.MONTHS.between(localDateTime2.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0),localDateTime1.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0));
         long daysDiff = ChronoUnit.DAYS.between(localDateTime2.withHour(0).withMinute(0).withSecond(0),localDateTime1.withHour(0).withMinute(0).withSecond(0));
         long hoursDiff = ChronoUnit.HOURS.between(localDateTime2.withMinute(0).withSecond(0),localDateTime1.withMinute(0).withSecond(0));
         long minutesDiff = ChronoUnit.MINUTES.between(localDateTime2.withSecond(0),localDateTime1.withSecond(0));
         long secondsDiff = ChronoUnit.SECONDS.between(localDateTime2,localDateTime1);
         //YEAR:年 MONTH:月 DAY:天 HOUR:小时 MINUTES:分钟 SECOND:秒
         //BEFORE:之前（小于） PRESENT:当前（等于） LATER:之后（大于）
         if(reqDto.getTimeUnitType().equals("YEAR")){
             retData.setTimeCompareResult(yearsDiff == 0 ? "PRESENT" : yearsDiff > 0 ? "LATER" : "BEFORE");
         }else if(reqDto.getTimeUnitType().equals("MONTH")){
             retData.setTimeCompareResult(monthsDiff == 0 ? "PRESENT" : monthsDiff > 0 ? "LATER" : "BEFORE");
         }else if(reqDto.getTimeUnitType().equals("DAY")){
             retData.setTimeCompareResult(daysDiff == 0 ? "PRESENT" : daysDiff > 0 ? "LATER" : "BEFORE");
         }else if(reqDto.getTimeUnitType().equals("HOUR")){
             retData.setTimeCompareResult(hoursDiff == 0 ? "PRESENT" : hoursDiff > 0 ? "LATER" : "BEFORE");
         }else if(reqDto.getTimeUnitType().equals("MINUTES")){
             retData.setTimeCompareResult(minutesDiff == 0 ? "PRESENT" : minutesDiff > 0 ? "LATER" : "BEFORE");
         }else if(reqDto.getTimeUnitType().equals("SECOND")){
             retData.setTimeCompareResult(secondsDiff == 0 ? "PRESENT" : secondsDiff > 0 ? "LATER" : "BEFORE");
         }
        return retData;
      }


/**
      * code:dataFilterSpecRecBy
      * name:M2获取数据集按入参过滤指定记录(特殊方法)
      * desc:undefined
      * gen by moon at 9/13/2023, 10:23:44 PM
      *
      **/
     @Trace(operationName = "M2获取数据集按入参过滤指定记录(特殊方法)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainDataFilterSpecRecByRespDto obtainDataFilterSpecRecBy(ObtainDataFilterSpecRecByReqDto reqDto) {
         ObtainDataFilterSpecRecByRespDto retData = new ObtainDataFilterSpecRecByRespDto();
         for(DataFilterSpecRecByDto one : reqDto.getDataFilterSpecRecByList()){
             if(!one.getComTxtField().equals(reqDto.getComTxtField())){
                 retData.getDataFilterSpecRecByList().add(one);
             }
         }
         return retData;
      }

    private static String convertToMarkdown(String html) {
        // Parse HTML and convert to Markdown
        MutableDataSet options = new MutableDataSet();
        String markdown = FlexmarkHtmlConverter.builder(options).build().convert(html);
        return markdown;
    }
/**
      * code:hypertextTurnToMarkdown
      * name:M2-执行富文本转markdown（特殊方法）
      * desc:undefined
      * gen by moon at 9/14/2023, 4:13:59 PM
      *
      **/
     @Trace(operationName = "M2-执行富文本转markdown（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementHypertextTurnToMarkdownRespDto implementHypertextTurnToMarkdown(ImplementHypertextTurnToMarkdownReqDto reqDto) {
         ImplementHypertextTurnToMarkdownRespDto retData =  new ImplementHypertextTurnToMarkdownRespDto();

         // Convert the text content to Markdown
         String markdown = convertToMarkdown(reqDto.getHypertextContent());
         retData.setMarkdownContent(markdown);
        return retData;
      }

    @Trace(operationName = "M2-执行对接第三方发送消息-打印消息接口返回数据")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
      public String printMsg(String req){
        System.out.println("消息返回: " + req + "\r\n");
         return req;
      }
/**
      * code:obtainThirdSendMsg
      * name:M2-执行对接第三方发送消息（特殊方法）
      * desc:undefined
      * gen by moon at 9/14/2023, 11:14:45 PM
      *
      **/
     @Trace(operationName = "M2-执行对接第三方发送消息（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementObtainThirdSendMsgRespDto implementObtainThirdSendMsg(ImplementObtainThirdSendMsgReqDto reqDto) {
         ImplementObtainThirdSendMsgRespDto retData = new ImplementObtainThirdSendMsgRespDto();
         try{
             List<Field> fieldsFieldList = CommonFunctionHelper.findSpecField(reqDto.getClass(),"Fields",reqDto);
             List<Field> allFields = CommonFunctionHelper.findSpecField(reqDto.getClass(),null,reqDto);
             Map<String,Field> fieldFieldIndex = new HashMap<>();
             Map<String,String> interfaceFieldMapping = new HashMap<>();
             for(Field one : fieldsFieldList){
                 fieldFieldIndex.put(one.getName(),one);
             }
             for(Field one : allFields){
                 if(fieldFieldIndex.containsKey(one.getName()+"Fields")){
                     Field nameValue = fieldFieldIndex.get(one.getName()+"Fields");
                     String fieldValue = (String)nameValue.get(reqDto);
                     String vValue = (String)one.get(reqDto);
                     interfaceFieldMapping.put(fieldValue,vValue);
                 }
             }
             printMsg(CommonFunctionHelper.sendRequest(reqDto.getMessageServeUrl(),reqDto.getInterfaceMethod(),interfaceFieldMapping,null));
         }catch (Exception e){

         }

        return retData;
      }
/**
      * code:stringLength
      * name:M2-获取字符串长度（特殊方法）
      * desc:undefined
      * gen by moon at 10/4/2023, 10:16:36 PM
      * 
      **/
     @Trace(operationName = "M2-获取字符串长度（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementGetStringLengthRespDto implementGetStringLength(ImplementGetStringLengthReqDto reqDto) {
         ImplementGetStringLengthRespDto retData = new ImplementGetStringLengthRespDto();
         if(reqDto.getCustomText()!=null){
             retData.setOutputNum(Long.valueOf(reqDto.getCustomText().length()));
         }
        return retData;
      }
/**
      * code:dataListGetMaxOrMiniByOrderNumber
      * name:M2-执行数据集根据排序字段取最大最小（特殊方法）
      * desc:undefined
      * gen by moon at 10/5/2023, 3:54:40 PM
      *
      **/
     @Trace(operationName = "M2-执行数据集根据排序字段取最大最小（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataListGetMaxOrMiniByOrderNumberRespDto implementDataListGetMaxOrMiniByOrderNumber(ImplementDataListGetMaxOrMiniByOrderNumberReqDto reqDto) {
         ImplementDataListGetMaxOrMiniByOrderNumberRespDto retData = new ImplementDataListGetMaxOrMiniByOrderNumberRespDto();
         ComDatasDto max = new ComDatasDto();
         ComDatasDto min = new ComDatasDto();
         if(reqDto.getOrderSizeType()!=null && reqDto.getOrderSizeType().equals("FROM_LARGE_SMALL")){
             for(ComDatasDto one : reqDto.getComDatasList()){
                 if(max==null){
                     max = one;
                     continue;
                 }
                 if(max.getOrderNumber()<one.getOrderNumber()){
                     max = one;
                 }
             }
             retData.setCustomField(max.getCustomField());
             retData.setCustomField1(max.getCustomField1());
         }else if(reqDto.getOrderSizeType()!=null && reqDto.getOrderSizeType().equals("FROM_SMALL_LARGE")){
             for(ComDatasDto one : reqDto.getComDatasList()){
                 if(min.getOrderNumber()==null){
                     min = one;
                     continue;
                 }
                 if(min.getOrderNumber()>one.getOrderNumber()){
                     min = one;
                 }
             }
             retData.setCustomField(min.getCustomField());
             retData.setCustomField1(min.getCustomField1());
         }
        return retData;
      }
/**
      * code:compTwoNumberOutputSpecText
      * name:M2-执行两数相比输出指定文本（特殊方法）
      * desc:undefined
      * gen by moon at 10/9/2023, 12:58:16 AM
      *
      **/
     @Trace(operationName = "M2-执行两数相比输出指定文本（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementCompTwoNumberOutputSpecTextRespDto implementCompTwoNumberOutputSpecText(ImplementCompTwoNumberOutputSpecTextReqDto reqDto) {
         ImplementCompTwoNumberOutputSpecTextRespDto retData = new ImplementCompTwoNumberOutputSpecTextRespDto();
         if(reqDto.getComFloatField() > Double.valueOf(reqDto.getFixedValue())){
             retData.setCustomField(reqDto.getFixedValue() + "+");
         }else{
             if(reqDto.getDecimalPointRules()==0L){
                 retData.setCustomField(String.valueOf(reqDto.getComFloatField().longValue()));
             }else if(reqDto.getDecimalPointRules()>0L){
                 BigDecimal bd = BigDecimal.valueOf(reqDto.getComFloatField());
                 bd = bd.setScale(reqDto.getDecimalPointRules().intValue(), RoundingMode.HALF_UP);
                 retData.setCustomField(String.valueOf(bd.doubleValue()));
             }
         }
        return retData;
      }
/**
      * code:dataAppointFormatShiftText
      * name:M2执行数据集按指定格式转文本
      * desc:undefined
      * gen by moon at 10/9/2023, 8:42:35 PM
      *
      **/
     @Trace(operationName = "M2执行数据集按指定格式转文本")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataAppointFormatShiftTextRespDto implementDataAppointFormatShiftText(ImplementDataAppointFormatShiftTextReqDto reqDto) {
         if(CollectionUtil.isEmpty(reqDto.getDataAppointFormatShiftTextList())){
             return new ImplementDataAppointFormatShiftTextRespDto();
         }
         ImplementDataAppointFormatShiftTextRespDto retData = new ImplementDataAppointFormatShiftTextRespDto();
         String result = String.join(reqDto.getCustomField1(), reqDto.getDataAppointFormatShiftTextList());
         retData.setCustomText(result);
         return retData;
      }
/**
      * code:markdownTurnToText
      * name:M2-执行markdown转文本（特殊方法）
      * desc:undefined
      * gen by moon at 10/9/2023, 8:42:53 PM
      *
      **/
     @Trace(operationName = "M2-执行markdown转文本（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementMarkdownTurnToTextRespDto implementMarkdownTurnToText(ImplementMarkdownTurnToTextReqDto reqDto) {
         ImplementMarkdownTurnToTextRespDto retData = new ImplementMarkdownTurnToTextRespDto();
         Parser parser = Parser.builder().build();
         Document document = parser.parse(reqDto.getMarkdownContent());
         HtmlRenderer renderer = HtmlRenderer.builder().build();
         String html = renderer.render(document);  // 将Markdown转换为HTML
         String plainText = html.replaceAll("<[^>]+>", "");  // 使用正则表达式去除HTML标签
         plainText = StringEscapeUtils.unescapeHtml4(plainText);
         plainText = plainText.replaceAll("\\n", " ");
         retData.setCustomText(plainText);
         return retData;
      }
/**
      * code:markdownDataListTurnToText
      * name:M2-执行markdown数据集转文本
      * desc:undefined
      * gen by moon at 10/22/2023, 7:21:38 PM
      *
      **/
     @Trace(operationName = "M2-执行markdown数据集转文本")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementMarkdownDataListTurnToTextRespDto implementMarkdownDataListTurnToText(ImplementMarkdownDataListTurnToTextReqDto reqDto) {
         ImplementMarkdownDataListTurnToTextRespDto retData = new ImplementMarkdownDataListTurnToTextRespDto();
         for(MarkdownDataListTurnToTextDto one : reqDto.getMarkdownDataListTurnToTextList()){
             MarkdownDataListTurnToTextDto elm = new MarkdownDataListTurnToTextDto();
             elm.setCommPrimaryKey(one.getCommPrimaryKey());
             elm.setCustomField(one.getCustomField());
             if(one.getMarkdownContent()!=null){
                 Parser parser = Parser.builder().build();
                 Document document = parser.parse(one.getMarkdownContent());
                 HtmlRenderer renderer = HtmlRenderer.builder().build();
                 String html = renderer.render(document);  // 将Markdown转换为HTML
                 String plainText = html.replaceAll("<[^>]+>", "");  // 使用正则表达式去除HTML标签
                 plainText = StringEscapeUtils.unescapeHtml4(plainText);
                 plainText = plainText.replaceAll("\\n", " ");
                 elm.setCustomField(plainText);
             }
             retData.getMarkdownDataListTurnToTextList().add(elm);
         }
        return retData;
      }
/**
      * code:encryptionAndDecryption
      * name:M2-执行加密解密（特殊方法）
      * desc:undefined
      * gen by moon at 10/26/2023, 11:02:35 PM
      *
      **/
     @Trace(operationName = "M2-执行加密解密（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementEncryptionAndDecryptionRespDto implementEncryptionAndDecryption(ImplementEncryptionAndDecryptionReqDto reqDto) {
         ImplementEncryptionAndDecryptionRespDto retData = new ImplementEncryptionAndDecryptionRespDto();
         retData.setEncryptionAndDecryptionModeResult(reqDto.getEncryptionAndDecryptionContent());
        return retData;
      }
/**
      * code:encryptionAndDecryptionByFixedKey
      * name:M2-执行固定密钥加密解密（特殊方法）
      * desc:undefined
      * gen by moon at 10/27/2023, 11:44:22 PM
      * 
      **/
     @Trace(operationName = "M2-执行固定密钥加密解密（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementEncryptionAndDecryptionByFixedKeyRespDto implementEncryptionAndDecryptionByFixedKey(ImplementEncryptionAndDecryptionByFixedKeyReqDto reqDto) {
         ImplementEncryptionAndDecryptionByFixedKeyRespDto retData = new ImplementEncryptionAndDecryptionByFixedKeyRespDto();
         String retContent = "";
         if(reqDto.getEncryptionOrDecryption().equals("ENCRYPTION")){
             if(reqDto.getEncryptionAndDecryptionMode().equals("DES")){
                 retContent = eDutil.desEncrypt("d9a01a589c3ae963350d8d62de53a554",reqDto.getEncryptionAndDecryptionContent());
             }
         }else{
             if(reqDto.getEncryptionAndDecryptionMode().equals("DES")){
                 retContent = eDutil.desDecrypt("d9a01a589c3ae963350d8d62de53a554",reqDto.getEncryptionAndDecryptionContent());
             }
         }
         retData.setEncryptionAndDecryptionModeResult(retContent);
        return retData;
      }
/**
      * code:encryptionAndDecryptionByDynamicKey
      * name:M2-执行动态密钥加密解密（特殊方法）
      * desc:undefined
      * gen by moon at 10/27/2023, 11:44:40 PM
      * 
      **/
     @Trace(operationName = "M2-执行动态密钥加密解密（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementEncryptionAndDecryptionByDynamicKeyRespDto implementEncryptionAndDecryptionByDynamicKey(ImplementEncryptionAndDecryptionByDynamicKeyReqDto reqDto) {
         ImplementEncryptionAndDecryptionByDynamicKeyRespDto retData = new ImplementEncryptionAndDecryptionByDynamicKeyRespDto();
         String retContent = "";
         if(reqDto.getEncryptionOrDecryption().equals("ENCRYPTION")){
             if(reqDto.getEncryptionAndDecryptionMode().equals("DES")){
                 retContent = eDutil.desEncrypt(reqDto.getSecretKey(),reqDto.getEncryptionAndDecryptionContent());
             }
         }else{
             if(reqDto.getEncryptionAndDecryptionMode().equals("DES")){
                 retContent = eDutil.desDecrypt(reqDto.getSecretKey(),reqDto.getEncryptionAndDecryptionContent());
             }
         }
         retData.setEncryptionAndDecryptionModeResult(retContent);
         return retData;
      }

//    public static void main(String[] args){
////        ImplementHypertextTurnToMarkdownReqDto req = new ImplementHypertextTurnToMarkdownReqDto();
////        req.setHypertextContent("<h1>一天的经历</h1>\n" +
////                "<p>早上，阳光透过窗户洒进卧室，唤醒了我。我从温暖的被窝中爬起来，迎接新的一天。</p>\n" +
////                "<p>早餐时间，我准备了一份丰盛的早餐。一碗热腾腾的燕麦粥，配上新鲜的水果和一杯香浓的咖啡，让我充满了活力。</p>\n" +
////                "<p>上午，我去了健身房。在那里，我进行了一小时的有氧运动和力量训练。汗水淋漓的感觉让我觉得焕然一新。</p>\n" +
////                "<p>中午，我与朋友相约在一家小餐馆用餐。我们点了各种美味的菜肴，边吃边聊天，度过了愉快的时光。</p>\n" +
////                "<p>下午，我回到家中，继续进行一项重要的工作项目。我专注地工作了几个小时，完成了一大部分任务。</p>\n" +
////                "<p>傍晚，我决定放松一下，去公园散步。漫步在花园里，欣赏美丽的风景，让我感到宁静和平静。</p>\n" +
////                "<p>晚餐时，我做了一顿美味的晚餐。烤鸡胸肉、烤蔬菜和沙拉，是一个健康而美味的选择。</p>\n" +
////                "<p>晚上，我和家人一起观看了一部电影。我们笑、哭、共享着电影带来的情感。</p>\n" +
////                "<p>夜晚，我回到卧室，感到一天的疲劳。我躺在床上，闭上眼睛，期待着明天的新开始。</p>\n" +
////                "<p>这一天充实而美好，充满了各种不同的活动和情感体验。</p>");
////        NbInterfaceMode o = new NbInterfaceMode();
////        ImplementHypertextTurnToMarkdownRespDto ret = o.implementHypertextTurnToMarkdown(req);
////        System.out.println(ret.getMarkdownContent());
//        NbInterfaceMode o = new NbInterfaceMode();
//        ImplementEncryptionAndDecryptionByFixedKeyReqDto req = new ImplementEncryptionAndDecryptionByFixedKeyReqDto();
//        req.setEncryptionOrDecryption("ENCRYPTION");
//        req.setEncryptionAndDecryptionMode("AES");
//        req.setEncryptionAndDecryptionContent("hrzces");
//        ImplementEncryptionAndDecryptionByFixedKeyRespDto ret = o.implementEncryptionAndDecryptionByFixedKey(req);
//        System.out.println(ret.getEncryptionAndDecryptionModeResult());
//
//        req.setEncryptionAndDecryptionContent(ret.getEncryptionAndDecryptionModeResult());
//        req.setEncryptionOrDecryption("DECRYPTION");
//        ret = o.implementEncryptionAndDecryptionByFixedKey(req);
//        System.out.println(ret.getEncryptionAndDecryptionModeResult());
//    }
/**
      * code:FILE_ADDRESS_ALL_PATH
      * name:M2执行文件地址输出全路径(特殊方法）
      * desc:undefined
      * gen by moon at 11/13/2023, 4:40:53 PM
      *
      **/
     @Trace(operationName = "M2执行文件地址输出全路径(特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementFileAddressAllPathRespDto implementFileAddressAllPath(ImplementFileAddressAllPathReqDto reqDto) {
         ImplementFileAddressAllPathRespDto retData = new ImplementFileAddressAllPathRespDto();
         if(reqDto.getCustomField()!=null){
             retData.setCustomField(CommonFunctionHelper.getFilePath(reqDto.getCustomField()));
         }
         return retData;
      }


    private static double calculateChronoUnitDifference(LocalDateTime start, LocalDateTime end, String timeUnit) {
        switch (timeUnit) {
            case "YEAR":
                return ChronoUnit.YEARS.between(start, end);
            case "MONTH":
                return ChronoUnit.MONTHS.between(start, end);
            case "DAY":
                return ChronoUnit.DAYS.between(start, end);
            case "SECOND":
                return ChronoUnit.SECONDS.between(start, end);
        }
        return -1d;
    }

    private static double applyDecimalRules(double value, int decimalPointRules, String decimalDigitsLastRules) {
        if (decimalDigitsLastRules == null || decimalDigitsLastRules.equals("NONE")) {
            return Math.floor(value);
        }

        BigDecimal bd = BigDecimal.valueOf(value);
        if (decimalDigitsLastRules.equals("ROUNDED")) {
            bd = bd.setScale(decimalPointRules, RoundingMode.HALF_UP);
        } else {
            bd = bd.setScale(decimalPointRules, RoundingMode.DOWN);
        }
        return bd.doubleValue();
    }

/**
      * code:twoTimeAddAndSub
      * name:M2-执行两时间加减（特殊方法）
      * desc:undefined
      * gen by moon at 11/29/2023, 3:21:32 AM
      *
      **/
     @Trace(operationName = "M2-执行两时间加减（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTwoTimeAddAndSubRespDto implementTwoTimeAddAndSub(ImplementTwoTimeAddAndSubReqDto reqDto) {
         //时间要反过来取，需求如此
         LocalDateTime start = LocalDateTime.ofInstant(reqDto.getCalcEndTime().toInstant(), ZoneId.systemDefault());
         LocalDateTime end = LocalDateTime.ofInstant(reqDto.getCalcStartTime().toInstant(), ZoneId.systemDefault());

         double result = 0L;
         // 根据时间单位调整开始时间和结束时间
         switch (reqDto.getTimeUnitType()) {
             case "YEAR":
                 start = start.withDayOfYear(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
                 end = end.withDayOfYear(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
                 break;
             case "MONTH":
                 start = start.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
                 end = end.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
                 break;
             case "DAY":
                 start = start.withHour(0).withMinute(0).withSecond(0).withNano(0);
                 end = end.withHour(0).withMinute(0).withSecond(0).withNano(0);
                 break;
         }

         // 计算时间差异
         switch (reqDto.getTimeUnitType()) {
             case "YEAR":
             case "MONTH":
             case "DAY":
                 result = calculateChronoUnitDifference(start,end,reqDto.getTimeUnitType());
                 break;
             case "HOUR":
             case "MINUTES":
             case "SECOND":
                 result = calculateChronoUnitDifference(start, end, "SECOND");
                 if (reqDto.getTimeUnitType().equals("HOUR")) {
                     result /= 3600.0;
                 } else if (reqDto.getTimeUnitType().equals("MINUTES")) {
                     result /= 60.0;
                 }
                 result = applyDecimalRules(result, Math.toIntExact(reqDto.getDecimalPointRules()), reqDto.getDecimalDigitsLastRules());
                 break;
         }

         if(reqDto.getDeviationDurationCompRule()!=null){
             switch (reqDto.getDeviationDurationCompRule()) {
                 case "ADD_ONE":
                     result += 1;
                     break;
                 case "SUB_ONE":
                     result -= 1;
                     break;
                 case "NONE":
                     // 不做任何操作
                     break;
             }
         }


         ImplementTwoTimeAddAndSubRespDto retData = new ImplementTwoTimeAddAndSubRespDto();
         retData.setTimeCalcResult(result);
         return retData;
      }

    public static void main(String[] args) {
        NbInterfaceMode o = new NbInterfaceMode();
//        ImplementDataRedistributionReqDto req = new ImplementDataRedistributionReqDto();
////        req.setReportScoreSubAndObjWeightOri(40d);
////        req.setProcessReportScoreProMidWeightOri(10d);
////        req.setProcessReportScoreMidWeightOri(10d);
////        req.setProcessReportScoreKrWeightOri(20d);
////        req.setProcessReportScoreAvgWeightOri(20d);
//
//
//
//        req.setReportScoreSubAndObjWeightChg(0.5d);
//        req.setProcessReportScoreProMidWeightChg(0.2d);
//        req.setProcessReportScoreMidWeightChg(0.2d);
//        req.setProcessReportScoreAvgWeightChg(0.1d);
//        req.setWeightTotal(1l);
//
//        ImplementDataRedistributionRespDto ret1 = o.implementDataRedistribution(req);
//
//        ImplementDataRedistributionReqDto req2 = new ImplementDataRedistributionReqDto();
//        req2.setReportScoreSubAndObjWeightChg(0.5d);
//        req2.setProcessReportScoreProMidWeightChg(0.2d);
//        req2.setProcessReportScoreMidWeightChg(0.1d);
//        req2.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret2 = o.implementDataRedistribution(req2);
//
//        ImplementDataRedistributionReqDto req3 = new ImplementDataRedistributionReqDto();
//        req3.setReportScoreSubAndObjWeightChg(0.5d);
//        req3.setProcessReportScoreProMidWeightChg(0.2d);
//        req3.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret3 = o.implementDataRedistribution(req3);
//
//        ImplementDataRedistributionReqDto req4 = new ImplementDataRedistributionReqDto();
//        req4.setReportScoreSubAndObjWeightChg(0.5d);
//        req4.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret4 = o.implementDataRedistribution(req4);
//
//        ImplementDataRedistributionReqDto req5 = new ImplementDataRedistributionReqDto();
//        req5.setReportScoreSubAndObjWeightChg(0.5d);
//        req5.setProcessReportScoreMidWeightChg(0.2d);
//        req5.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret5 = o.implementDataRedistribution(req5);
//
//        ImplementDataRedistributionReqDto req6 = new ImplementDataRedistributionReqDto();
//        req6.setReportScoreSubAndObjWeightChg(0.5d);
//        req6.setProcessReportScoreAvgWeightChg(0.2d);
//        req6.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret6 = o.implementDataRedistribution(req6);
//
//
//        ImplementDataRedistributionReqDto req7 = new ImplementDataRedistributionReqDto();
//        req7.setReportScoreSubAndObjWeightChg(0.3d);
//        req7.setProcessReportScoreProMidWeightChg(0.4d);
//        req7.setProcessReportScoreMidWeightChg(0.2d);
//        req7.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret7 = o.implementDataRedistribution(req7);
//
//        ImplementDataRedistributionReqDto req8 = new ImplementDataRedistributionReqDto();
//        req8.setReportScoreSubAndObjWeightChg(0.3d);
//        req8.setProcessReportScoreMidWeightChg(0.2d);
//        req8.setWeightTotal(1l);
//        ImplementDataRedistributionRespDto ret8 = o.implementDataRedistribution(req8);
//
//
//
//        ImplementDataRedistributionReqDto req9 = new ImplementDataRedistributionReqDto();
////        req.setReportScoreSubAndObjWeightOri(40d);
////        req.setProcessReportScoreProMidWeightOri(10d);
////        req.setProcessReportScoreMidWeightOri(10d);
////        req.setProcessReportScoreKrWeightOri(20d);
////        req.setProcessReportScoreAvgWeightOri(20d);
//
//
//
//        req9.setReportScoreSubAndObjWeightChg(50d);
//        req9.setProcessReportScoreProMidWeightChg(20d);
//        req9.setProcessReportScoreMidWeightChg(20d);
//        req9.setProcessReportScoreAvgWeightChg(10d);
//        req9.setWeightTotal(100l);
//
//        ImplementDataRedistributionRespDto ret9 = o.implementDataRedistribution(req9);
//
//        ImplementDataRedistributionReqDto req10 = new ImplementDataRedistributionReqDto();
//        req10.setReportScoreSubAndObjWeightChg(50d);
//        req10.setProcessReportScoreProMidWeightChg(20d);
//        req10.setProcessReportScoreMidWeightChg(10d);
//        req10.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret10 = o.implementDataRedistribution(req10);
//
//        ImplementDataRedistributionReqDto req11 = new ImplementDataRedistributionReqDto();
//        req11.setReportScoreSubAndObjWeightChg(50d);
//        req11.setProcessReportScoreProMidWeightChg(20d);
//        req11.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret11 = o.implementDataRedistribution(req11);
//
//        ImplementDataRedistributionReqDto req12 = new ImplementDataRedistributionReqDto();
//        req12.setReportScoreSubAndObjWeightChg(50d);
//        req12.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret12 = o.implementDataRedistribution(req12);
//
//        ImplementDataRedistributionReqDto req13 = new ImplementDataRedistributionReqDto();
//        req13.setReportScoreSubAndObjWeightChg(50d);
//        req13.setProcessReportScoreMidWeightChg(20d);
//        req13.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret13 = o.implementDataRedistribution(req13);
//
//        ImplementDataRedistributionReqDto req14 = new ImplementDataRedistributionReqDto();
//        req14.setReportScoreSubAndObjWeightChg(50d);
//        req14.setProcessReportScoreAvgWeightChg(20d);
//        req14.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret14 = o.implementDataRedistribution(req14);
//
//
//        ImplementDataRedistributionReqDto req15 = new ImplementDataRedistributionReqDto();
//        req15.setReportScoreSubAndObjWeightChg(30d);
//        req15.setProcessReportScoreProMidWeightChg(40d);
//        req15.setProcessReportScoreMidWeightChg(20d);
//        req15.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret15 = o.implementDataRedistribution(req15);
//
//        ImplementDataRedistributionReqDto req16 = new ImplementDataRedistributionReqDto();
//        req16.setReportScoreSubAndObjWeightChg(30d);
//        req16.setProcessReportScoreMidWeightChg(20d);
//        req16.setWeightTotal(100l);
//        ImplementDataRedistributionRespDto ret16 = o.implementDataRedistribution(req16);

        // 创建AnalysisFieldBatchDataReqDto对象
        AnalysisFieldBatchDataReqDto dto = new AnalysisFieldBatchDataReqDto();

// 使用setter方法设置所有属性值
        dto.setCustomField1("TOTAL_NUMBER_OF_TASKS");
        dto.setCustomFieldValue1("1670.0");
        dto.setCustomField2("NUMBER_OF_TOBESIGN_TASKS");
        dto.setCustomFieldValue2(null);
        dto.setCustomField3("NUMBER_OF_OVERDUE_TASKS");
        dto.setCustomFieldValue3("1670.0");
        dto.setCustomField4("NUMBER_OF_NOT_AT_THE_TASKS");
        dto.setCustomFieldValue4(null);
        dto.setCustomField5("NUMBER_OF_ONGOING_TASKS");
        dto.setCustomFieldValue5(null);
        dto.setCustomField6("NUMBER_OF_COMPLETED_TASKS");
        dto.setCustomFieldValue6(null);
        dto.setCustomField7("NUMBER_OF_FAILED_TASKS");
        dto.setCustomFieldValue7("872.0");
        dto.setCustomField8("AVERAGE_TASK_PROGRESS");
        dto.setCustomFieldValue8(null);
        dto.setCustomField9("TOTAL_NUMBER_OF_QUESTIONS");
        dto.setCustomFieldValue9("0.0");
        dto.setCustomField10("NUMBER_OF_UNRESOLVED_ISSUES");
        dto.setCustomFieldValue10("0.0");
        dto.setCustomField11("NUMBER_OF_SUSPENDED_PROBLEMS");
        dto.setCustomFieldValue11("0.0");
        dto.setCustomField12("NUMBER_OF_REJECTED_PROBLEMS");
        dto.setCustomFieldValue12("0.0");
        dto.setCustomField13("NUMBER_OF_SHELVE_PROBLEMS");
        dto.setCustomFieldValue13("0.0");
        dto.setCustomField14("NUMBER_OF_SOLVED_PROBLEMS");
        dto.setCustomFieldValue14("0.0");
        dto.setCustomField15("NUMBER_OF_TIMEOUT_ISSUES");
        dto.setCustomFieldValue15("0.0");
        dto.setCustomField16("NUMBER_OF_CLOSED_PROBLEMS");
        dto.setCustomFieldValue16("0.0");
        dto.setCustomField17("AVERAGE_PROBLEM_SOLVING_TIME");
        dto.setCustomFieldValue17("0.0");
        dto.setCustomField18("NUMBER_OF_OBJECTIVE");
        dto.setCustomFieldValue18("85");
        dto.setCustomField19("NUMBER_OF_UNREPORTED_TASKS");
        dto.setCustomFieldValue19("798.0");
        dto.setCustomField20("NUMBER_OF_EVA_TASKS");
        dto.setCustomFieldValue20("0.0");
        dto.setCustomField21("NUMBER_OF_AUDIT_TASKS");
        dto.setCustomFieldValue21("0.0");
        dto.setCustomField22("NUMBER_OF_SUCCESS_TASKS");
        dto.setCustomFieldValue22("0.0");
        dto.setCustomField23("NUMBER_OF_TOBEFILL_TASKS");
        dto.setCustomFieldValue23(null);
        dto.setCustomField24("NUMBER_OF_TOBEEVA_TASKS");
        dto.setCustomFieldValue24(null);
        dto.setCustomField25("TARGET_ALIGNMENT_NUMBER");
        dto.setCustomFieldValue25(null);
        dto.setCustomField26("TARGET_ALIGNMENT_RATE");
        dto.setCustomFieldValue26(null);
        dto.setCustomField27("NUMBER_OF_LAST_OBJECTIVE");
        dto.setCustomFieldValue27(null);
        dto.setCustomField28("CUSTOM_FIELD_28");
        dto.setCustomFieldValue28(null);
        dto.setCustomField29("CUSTOM_FIELD_29");
        dto.setCustomFieldValue29(null);
        dto.setCustomField30("CUSTOM_FIELD_30");
        dto.setCustomFieldValue30(null);
        dto.setCustomField31("CUSTOM_FIELD_31");
        dto.setCustomFieldValue31(null);
        dto.setCustomField32("CUSTOM_FIELD_32");
        dto.setCustomFieldValue32(null);
        dto.setCustomField33("CUSTOM_FIELD_33");
        dto.setCustomFieldValue33(null);
        dto.setCustomField34("CUSTOM_FIELD_34");
        dto.setCustomFieldValue34(null);
        dto.setCustomField35("CUSTOM_FIELD_35");
        dto.setCustomFieldValue35(null);
        dto.setCustomField36("CUSTOM_FIELD_36");
        dto.setCustomFieldValue36(null);
        dto.setCustomField37("CUSTOM_FIELD_37");
        dto.setCustomFieldValue37(null);
        dto.setCustomField38("CUSTOM_FIELD_38");
        dto.setCustomFieldValue38(null);
        dto.setCustomField39("CUSTOM_FIELD_39");
        dto.setCustomFieldValue39(null);
        dto.setCustomField40("CUSTOM_FIELD_40");
        dto.setCustomFieldValue40(null);
        dto.setCustomField41("CUSTOM_FIELD_41");
        dto.setCustomFieldValue41(null);
        dto.setCustomField42("CUSTOM_FIELD_42");
        dto.setCustomFieldValue42(null);
        dto.setCustomField43("CUSTOM_FIELD_43");
        dto.setCustomFieldValue43(null);
        dto.setCustomField44("CUSTOM_FIELD_44");
        dto.setCustomFieldValue44(null);
        dto.setCustomField45("CUSTOM_FIELD_45");
        dto.setCustomFieldValue45(null);
        dto.setCustomField46("CUSTOM_FIELD_46");
        dto.setCustomFieldValue46(null);
        dto.setCustomField47("CUSTOM_FIELD_47");
        dto.setCustomFieldValue47(null);
        dto.setCustomField48("CUSTOM_FIELD_48");
        dto.setCustomFieldValue48(null);
        dto.setCustomField49("CUSTOM_FIELD_49");
        dto.setCustomFieldValue49(null);
        dto.setCustomField50("CUSTOM_FIELD_50");
        dto.setCustomFieldValue50(null);

//        o.analysisFieldBatchData(dto);

        AddNodeGraphDatabaseReqDto reqDto = new AddNodeGraphDatabaseReqDto();
        reqDto.setNodeType("空间");
        NodeAttributeGraphDatabaseDto attr = new NodeAttributeGraphDatabaseDto();
        attr.setAttributeName("spaceName");
        attr.setAttributeValue("新数质");
        reqDto.getNodeAttributeGraphDatabaseList().add(attr);
        o.addNodeGraphDatabase(reqDto);
        System.out.println("111");

    }
/**
      * code:additionOfTwoNum
      * name:M2计算两个数值相加（特殊方法）
      * desc:undefined
      * gen by moon at 12/12/2023, 5:00:34 AM
      *
      **/
     @Trace(operationName = "M2计算两个数值相加（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public CalculateAdditionOfTwoNumsRespDto calculateAdditionOfTwoNums(CalculateAdditionOfTwoNumsReqDto reqDto) {
         CalculateAdditionOfTwoNumsRespDto retData = new CalculateAdditionOfTwoNumsRespDto();

         retData.setCalcResult(reqDto.getCalcPara1().doubleValue() + reqDto.getCalcPara2().doubleValue());
         return retData;
      }
/**
      * code:dataPressRemoveMultipleEntries
      * name:M2判断数据集按入参去N条
      * desc:undefined
      * gen by moon at 12/14/2023, 2:50:55 PM
      *
      **/
     @Trace(operationName = "M2判断数据集按入参去N条")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public JudgeDataPressRemoveMultipleEntriesRespDto judgeDataPressRemoveMultipleEntries(JudgeDataPressRemoveMultipleEntriesReqDto reqDto) {
         JudgeDataPressRemoveMultipleEntriesRespDto retData = new JudgeDataPressRemoveMultipleEntriesRespDto();
         for(DataFilterSpecRecByDto one : reqDto.getDataFilterSpecRecByList()){
             if(one.getCustomField()!=null && one.getCustomField().equals(reqDto.getCustomField())){
                 continue;
             }
             DataFilterSpecRecByDto elm = new DataFilterSpecRecByDto();
             BeanUtil.copyProperties(one,elm);
             retData.getDataFilterSpecRecByList().add(elm);
         }
        return retData;
      }
/**
      * code:receptionService
      * name:M2执行接文本字段数据集
      * desc:undefined
      * gen by moon at 12/14/2023, 2:51:19 PM
      *
      **/
     @Trace(operationName = "M2执行接文本字段数据集")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementConnectTextFieldDatasetRespDto implementConnectTextFieldDataset(ImplementConnectTextFieldDatasetReqDto reqDto) {
         return BeanUtil.toBean(reqDto,ImplementConnectTextFieldDatasetRespDto.class);
      }
/**
      * code:fieldsNameAndValueToOneDatas
      * name:M2执行字段名与值转数据集
      * desc:undefined
      * gen by moon at 12/20/2023, 9:15:10 PM
      *
      **/
     @Trace(operationName = "M2执行字段名与值转数据集")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementFieldsNameAndValueToOneDatasRespDto implementFieldsNameAndValueToOneDatas(ImplementFieldsNameAndValueToOneDatasReqDto reqDto) {
         ImplementFieldsNameAndValueToOneDatasRespDto retData = new ImplementFieldsNameAndValueToOneDatasRespDto();
         FieldsNameAndValueToOneDatasDto elm = new FieldsNameAndValueToOneDatasDto();
         elm.setFieldName(reqDto.getFieldName());
         elm.setFieldValue(reqDto.getFieldValue());
         retData.getFieldsNameAndValueToOneDatasList().add(elm);
        return retData;
      }
/**
      * code:dateFormat
      * name:M2执行时间格式化
      * desc:undefined
      * gen by moon at 12/23/2023, 11:08:43 PM
      *
      **/
     @Trace(operationName = "M2执行时间格式化")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDateFormatRespDto implementDateFormat(ImplementDateFormatReqDto reqDto) {
         ImplementDateFormatRespDto retData = new ImplementDateFormatRespDto();
         try{
             SimpleDateFormat sdf = new SimpleDateFormat(reqDto.getTimeFormatMode());
             if(sdf!=null){
                 retData.setComTxtField(sdf.format(reqDto.getComTimeField()));
             }
         }catch (Exception e){
             String msg = reqDto.getTimeFormatMode() + "-" + reqDto.getComTimeField();
             throw new BizException("-1","时间格式化失败:"+msg,false);
         }

         return retData;
      }
/**
      * code:transactionWaitingTime
      * name:M2执行事务等待时长(特殊方法）
      * desc:undefined
      * gen by moon at 1/22/2024, 11:05:31 PM
      *
      **/
     @Trace(operationName = "M2执行事务等待时长(特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTransactionWaitingTimeRespDto implementTransactionWaitingTime(ImplementTransactionWaitingTimeReqDto reqDto) {
         try {
             Thread.sleep(Long.valueOf(reqDto.getWaitingTime())*1000);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
         return new ImplementTransactionWaitingTimeRespDto();
      }
/**
      * code:distributedLocking
      * name:M2-执行并发行为主题锁（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:36:14 PM
      *
      **/
     @Trace(operationName = "M2-执行并发行为主题锁（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementConcBhvThemeLockComRespDto implementConcBhvThemeLockCom(ImplementConcBhvThemeLockComReqDto reqDto) {
         String lockKeyPrefix = reqDto.getBehaviorThemeLockCode() + "_" + reqDto.getCommPrimaryKey();
         if(reqDto.getCustomField1()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField1();
         }

         if(reqDto.getCustomField2()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField2();
         }

         if(reqDto.getCustomField3()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField3();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             lockKeyPrefix = reqDto.getRedisDataObjectCatalogue() + ":" + lockKeyPrefix;
         }
         Long duration = 0L;
         duration = DateTimeUtil.getSecond(reqDto.getTimeUnitType(),reqDto.getDuration());
         ImplementConcBhvThemeLockComRespDto retData = new ImplementConcBhvThemeLockComRespDto();
         boolean bRet =  redisUtil.getLock(lockKeyPrefix,lockKeyPrefix,duration);
         retData.setPreventConcurrentLockingSituations("EMPTY_LOCK_SUCCESSFUL");
         if(!bRet){
             retData.setPreventConcurrentLockingSituations("CONCURRENT_LOCK_FAILURE");
         }else{
             if(!CommonFunctionHelper.checkBaseInfo()){
                 CommonFunctionHelper.setBaseInfoToLocal(new BaseInfoDO());
             }
             CommonFunctionHelper.getBaseInfoFromLocal().getLockList().add(lockKeyPrefix);
         }
         return retData;
      }
/**
      * code:distributedBatchUnlock
      * name:M2-执行批量解锁并发行为主题锁（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:36:20 PM
      *
      **/
     @Trace(operationName = "M2-执行批量解锁并发行为主题锁（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementBatchUnlockingConcBhvThemesLockComRespDto implementBatchUnlockingConcBhvThemesLockCom(ImplementBatchUnlockingConcBhvThemesLockComReqDto reqDto) {
         String lockKeyPrefix = reqDto.getBehaviorThemeLockCode();
         if(reqDto.getCommPrimaryKey()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCommPrimaryKey();
         }
         if(reqDto.getCustomField1()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField1();
         }

         if(reqDto.getCustomField2()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField2();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             lockKeyPrefix = reqDto.getRedisDataObjectCatalogue() + ":" + lockKeyPrefix;
         }
         ImplementBatchUnlockingConcBhvThemesLockComRespDto retData = new ImplementBatchUnlockingConcBhvThemesLockComRespDto();
         List<String> lockList =  redisUtil.findKeysByPrefix(lockKeyPrefix);
         for(String one : lockList){
             redisUtil.releaseLock(one,one);
         }
         return retData;
      }
/**
      * code:distributedUnlocking
      * name:M2-执行解锁并发行为主题锁（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:36:26 PM
      *
      **/
     @Trace(operationName = "M2-执行解锁并发行为主题锁（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementUnlockingConcBhvThemesLockComRespDto implementUnlockingConcBhvThemesLockCom(ImplementUnlockingConcBhvThemesLockComReqDto reqDto) {
         String lockKeyPrefix = reqDto.getBehaviorThemeLockCode() + "_" + reqDto.getCommPrimaryKey();
         if(reqDto.getCustomField1()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField1();
         }

         if(reqDto.getCustomField2()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField2();
         }

         if(reqDto.getCustomField3()!=null){
             lockKeyPrefix = lockKeyPrefix + "_" + reqDto.getCustomField3();
         }

         if(reqDto.getRedisDataObjectCatalogue()!=null){
             lockKeyPrefix = reqDto.getRedisDataObjectCatalogue() + ":" + lockKeyPrefix;
         }
         ImplementUnlockingConcBhvThemesLockComRespDto retData = new ImplementUnlockingConcBhvThemesLockComRespDto();
         redisUtil.releaseLock(lockKeyPrefix,lockKeyPrefix);
         return retData;
      }

      public Long calcTime(Long duration,String type){
         //时间单位类型 YEAR:年 MONTH:月 DAY:天 HOUR:小时 MINUTES:分钟 SECOND:秒
         Long retData = 0l;
         if(type.equals("YEAR")){
             retData = duration*31536000;
         }else if(type.equals("MONTH")){
             retData = duration*2592000;
         }else if(type.equals("DAY")){
             retData = duration*86400;
         }else if(type.equals("HOUR")){
             retData = duration*3600;
         }else if(type.equals("MINUTES")){
             retData = duration*60;
         }else if(type.equals("SECOND")){
             retData = duration;
         }
         return retData;
      }

/**
      * code:addRedisBusinessData
      * name:M2-新增redis业务数据对象（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:36:50 PM
      *
      **/
     @Trace(operationName = "M2-新增redis业务数据对象（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddRedisBusinessDataRespDto addRedisBusinessData(AddRedisBusinessDataReqDto reqDto) {
         AddRedisBusinessDataRespDto retData = new AddRedisBusinessDataRespDto();
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }

         if(reqDto.getIsDeleteRedis()!=null && reqDto.getIsDeleteRedis().equals("TRUE")){
             redisUtil.delete(key);
         }

         Long timeOut = 999999999l;
         if(reqDto.getDuration()!=null && reqDto.getTimeUnitType()!=null){
             timeOut = calcTime(reqDto.getDuration(),reqDto.getTimeUnitType());
         }

         JSONObject objectData = new JSONObject();
         for(FieldDataDto one : reqDto.getFieldDataList()){
             objectData.put(one.getFieldName(),one.getFieldValue());
         }
         if(reqDto.getIsDataList().equals("TRUE")){
             Object currentData = redisUtil.get(key);
             if(currentData!=null){
                 if(currentData instanceof JSONArray){
                     JSONArray arrayData = (JSONArray)currentData;
                     arrayData.add(objectData);
                     redisUtil.set(key,arrayData,timeOut, TimeUnit.SECONDS);
                 }else{
                     throw new BizException("-1","想取数据集，但是存的是对象",false);
                 }
             }else{
                 JSONArray arrayData = new JSONArray();
                 arrayData.add(objectData);
                 redisUtil.set(key,arrayData,timeOut, TimeUnit.SECONDS);
             }
         }else{
             redisUtil.set(key,objectData,timeOut, TimeUnit.SECONDS);
         }
        return new AddRedisBusinessDataRespDto();
      }
/**
      * code:queryRedisBusinessData
      * name:M2-查询redis业务数据对象列表（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:37:17 PM
      *
      **/
     @Trace(operationName = "M2-查询redis业务数据对象列表（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryRedisBusinessDataListRespDto queryRedisBusinessDataList(QueryRedisBusinessDataListReqDto reqDto) {
         QueryRedisBusinessDataListRespDto retData = new QueryRedisBusinessDataListRespDto();
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }

         JSONArray currentData = (JSONArray)redisUtil.get(key);
         if(currentData==null || currentData.size()==0){
             return retData;
         }

         Map<String,Field> fieldIndex = new HashMap<>();
         Field[] fields = RedisBusinessDataResDto.class.getDeclaredFields();
         for(Field one : fields){
             one.setAccessible(true);
             fieldIndex.put(one.getName(),one);
         }

         currentData.forEach(item -> {
             RedisBusinessDataResDto elm = new RedisBusinessDataResDto();
             JSONObject jsonObject = (JSONObject) item;
             for(RedisBusinessDataResDto one : reqDto.getRedisBusinessDataResList()){
                 Object value = jsonObject.get(one.getFieldName());
                 Field field = fieldIndex.get(one.getMapFieldName());
                 if(value!=null){
                     try {
                         field.set(elm,value);
                     } catch (IllegalAccessException e) {
                         e.printStackTrace();
                     }
                 }
             }
             retData.getRedisBusinessDataResList().add(elm);
         });

        return retData;
      }
/**
      * code:deleteRedisBusinessData
      * name:M2-删除redis业务数据对象（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:37:35 PM
      *
      **/
     @Trace(operationName = "M2-删除redis业务数据对象（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public DeleteRedisBusinessDataRespDto deleteRedisBusinessData(DeleteRedisBusinessDataReqDto reqDto) {

         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }

         if(CollectionUtil.isEmpty(reqDto.getFieldDataList())){
             redisUtil.delete(key);
         }else{
             JSONArray jd = (JSONArray)redisUtil.get(key);
             if(jd!=null){
                 for (int i = jd.size() - 1; i >= 0; i--) {
                     JSONObject jsonObject = jd.getJSONObject(i);
                     boolean bRemove = true;
                     for(FieldDataDto conditionOne : reqDto.getFieldDataList()){
                         String value = (String)jsonObject.get(conditionOne.getFieldName());
                         if(value!=null && value.equals(conditionOne.getFieldValue())){
                             continue;
                         }else{
                             bRemove = false;
                             break;
                         }
                     }
                     if(bRemove){
                         jd.remove(i);
                     }
                 }
                 redisUtil.set(key,jd);
             }

         }

        return new DeleteRedisBusinessDataRespDto();
      }
/**
      * code:queryRedisBusinessDataObject
      * name:M2-查询redis业务数据对象详情（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 7:37:54 PM
      *
      **/
     @Trace(operationName = "M2-查询redis业务数据对象详情（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryRedisBusinessDataDetailRespDto queryRedisBusinessDataDetail(QueryRedisBusinessDataDetailReqDto reqDto) {
         QueryRedisBusinessDataDetailRespDto retData = new QueryRedisBusinessDataDetailRespDto();
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }
         JSONObject currentData = (JSONObject)redisUtil.get(key);
         if(currentData==null){
             return retData;
         }

         Map<String,Field> fieldIndex = new HashMap<>();
         Field[] fields = QueryRedisBusinessDataDetailRespDto.class.getDeclaredFields();
         for(Field one : fields){
             one.setAccessible(true);
             fieldIndex.put(one.getName(),one);
         }


         for(RedisBusinessDataResDto one : reqDto.getRedisBusinessDataResList()){
             Object value = currentData.get(one.getFieldName());
             Field field = fieldIndex.get(one.getMapFieldName());
             if(value!=null){
                 try {
                     field.set(retData,value);
                 } catch (IllegalAccessException e) {
                     e.printStackTrace();
                 }
             }
         }

         return retData;
      }
/**
      * code:fieldBatchData
      * name:M2-分析单字段批量转数据集（特殊方法）
      * desc:undefined
      * gen by moon at 2/1/2024, 11:01:32 PM
      *
      **/
     @Trace(operationName = "M2-分析单字段批量转数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AnalysisFieldBatchDataRespDto analysisFieldBatchData(AnalysisFieldBatchDataReqDto reqDto) {
         AnalysisFieldBatchDataRespDto retData = new AnalysisFieldBatchDataRespDto();
         Field[] fieldInfo = AnalysisFieldBatchDataReqDto.class.getDeclaredFields();
         //customField1
         //customFieldValue1
         Long count = 1l;


         Map<String,String> dealKeyData = new HashMap<>();
         Map<String,String> dealData = new LinkedHashMap<>();
         long parCount = 1L;
         for(Field one : fieldInfo){
             String fieldKey = "customField" + count;
             String fieldValueKey = "customFieldValue" + count;
             one.setAccessible(true);
             try {
                 String value = (String)one.get(reqDto);
                 if(value!=null){
                     if(one.getName().contains(fieldKey)){
                         dealKeyData.put(fieldKey,value);
                     }
                 }

                 if(one.getName().contains(fieldValueKey) && dealKeyData.containsKey(fieldKey)){
                     dealData.put(dealKeyData.get(fieldKey),value);
                 }
             } catch (IllegalAccessException e) {
                 e.printStackTrace();
             }
             if(parCount % 2 ==0L){
                 count++;
             }
             parCount++;
         }

         for(Map.Entry<String,String> one : dealData.entrySet()){
             if(one.getValue()!=null && !one.getValue().isEmpty()){
                 FieldBatchDataDto elm = new FieldBatchDataDto();
                 elm.setFieldName(one.getKey());
                 elm.setFieldValue(one.getValue());
                 retData.getFieldBatchDataList().add(elm);
             }
         }
        return retData;
      }
/**
      * code:queryRedisBusinessSomeData
      * name:M2-查询入参redis业务数据对象列表（特殊方法）
      * desc:undefined
      * gen by moon at 2/4/2024, 7:42:11 PM
      *
      **/
     @Trace(operationName = "M2-查询入参redis业务数据对象列表（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryRefRedisBusinessDataListRespDto queryRefRedisBusinessDataList(QueryRefRedisBusinessDataListReqDto reqDto) {
         QueryRefRedisBusinessDataListRespDto retData = new QueryRefRedisBusinessDataListRespDto();
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }
         JSONArray currentData = (JSONArray)redisUtil.get(key);
         if(currentData==null || currentData.size()==0){
             return retData;
         }

         Map<String,Field> fieldIndex = new HashMap<>();
         Field[] fields = RedisBusinessDataResDto.class.getDeclaredFields();
         for(Field one : fields){
             one.setAccessible(true);
             fieldIndex.put(one.getName(),one);
         }

         Map<String,String> queryKey = new HashMap<>();
         if(reqDto.getRefCustomField1()!=null && reqDto.getRefCustomFieldValue1()!=null){
             queryKey.put(reqDto.getRefCustomField1(),reqDto.getRefCustomFieldValue1());
         }

         if(reqDto.getRefCustomField2()!=null && reqDto.getRefCustomFieldValue2()!=null){
             queryKey.put(reqDto.getRefCustomField2(),reqDto.getRefCustomFieldValue2());
         }

         if(reqDto.getRefCustomField3()!=null && reqDto.getRefCustomFieldValue3()!=null){
             queryKey.put(reqDto.getRefCustomField3(),reqDto.getRefCustomFieldValue3());
         }

         if(reqDto.getRefCustomField4()!=null && reqDto.getRefCustomFieldValue4()!=null){
             queryKey.put(reqDto.getRefCustomField4(),reqDto.getRefCustomFieldValue4());
         }

         if(reqDto.getRefCustomField5()!=null && reqDto.getRefCustomFieldValue5()!=null){
             queryKey.put(reqDto.getRefCustomField5(),reqDto.getRefCustomFieldValue5());
         }

         if(reqDto.getRefCustomField6()!=null && reqDto.getRefCustomFieldValue6()!=null){
             queryKey.put(reqDto.getRefCustomField6(),reqDto.getRefCustomFieldValue6());
         }

         if(reqDto.getRefCustomField7()!=null && reqDto.getRefCustomFieldValue7()!=null){
             queryKey.put(reqDto.getRefCustomField7(),reqDto.getRefCustomFieldValue7());
         }

         if(reqDto.getRefCustomField8()!=null && reqDto.getRefCustomFieldValue8()!=null){
             queryKey.put(reqDto.getRefCustomField8(),reqDto.getRefCustomFieldValue8());
         }

         currentData.forEach(item -> {
             JSONObject jsonObject = (JSONObject) item;
             boolean bFlag = true;
             for(Map.Entry<String,String> one : queryKey.entrySet()) {
                 if (!jsonObject.containsKey(one.getKey())) {
                     bFlag = false;
                     break;
                 }else{
                     Object value = jsonObject.get(one.getKey());
                     String strValue = String.valueOf(value);
                     if(!strValue.equals(one.getValue())){
                         bFlag = false;
                         break;
                     }
                 }
             }
             if(bFlag && reqDto.getBatchQueryRefDataFieldName()!=null && CollectionUtil.isNotEmpty(reqDto.getRefRedisBusinessDataList())){
                 Object value = jsonObject.get(reqDto.getBatchQueryRefDataFieldName());
                 String strValue = String.valueOf(value);
                 if(!reqDto.getRefRedisBusinessDataList().contains(strValue)){
                     bFlag = false;
                 }
             }
             if(bFlag){
                 RedisBusinessDataResDto elm = new RedisBusinessDataResDto();
                 for(RedisBusinessDataResDto one : reqDto.getRedisBusinessDataResList()){
                     Object value = jsonObject.get(one.getFieldName());
                     Field field = fieldIndex.get(one.getMapFieldName());
                     if(value!=null){
                         try {
                             field.set(elm,value);
                         } catch (IllegalAccessException e) {
                             e.printStackTrace();
                         }
                     }

                 }
                 retData.getRedisBusinessDataResList().add(elm);
             }
         });

         return retData;
      }

    /**
     * code:queryRedisBusinessOneData
     * name:M2-查询入参redis业务数据对象详情（特殊方法）
     * desc:undefined
     * gen by moon at 2/5/2024, 8:55:22 PM
     *
     **/
    @Trace(operationName = "M2-查询入参redis业务数据对象详情（特殊方法）")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
    public QueryRefRedisBusinessDataDetailRespDto queryRefRedisBusinessDataDetail(QueryRefRedisBusinessDataDetailReqDto reqDto) {
        List<QueryRefRedisBusinessDataDetailRespDto> collectList = new ArrayList<>();
        final QueryRefRedisBusinessDataDetailRespDto[] retData = {new QueryRefRedisBusinessDataDetailRespDto()};
        String key = null;
        if(reqDto.getDataObjectBatchCode()!=null){
            key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
        }else{
            key = reqDto.getBusinessDataObject();
        }


        if(reqDto.getRedisDataObjectCatalogue()!=null){
            key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
        }
        JSONArray currentData = (JSONArray)redisUtil.get(key);
        if(currentData==null || currentData.size()==0){
            return retData[0];
        }

        Map<String,Field> fieldIndex = new HashMap<>();
        Field[] fields = QueryRefRedisBusinessDataDetailRespDto.class.getDeclaredFields();
        for(Field one : fields){
            one.setAccessible(true);
            fieldIndex.put(one.getName(),one);
        }

        Map<String,String> queryKey = new HashMap<>();
        if(reqDto.getRefCustomField1()!=null && reqDto.getRefCustomFieldValue1()!=null){
            queryKey.put(reqDto.getRefCustomField1(),reqDto.getRefCustomFieldValue1());
        }

        if(reqDto.getRefCustomField2()!=null && reqDto.getRefCustomFieldValue2()!=null){
            queryKey.put(reqDto.getRefCustomField2(),reqDto.getRefCustomFieldValue2());
        }

        if(reqDto.getRefCustomField3()!=null && reqDto.getRefCustomFieldValue3()!=null){
            queryKey.put(reqDto.getRefCustomField3(),reqDto.getRefCustomFieldValue3());
        }

        if(reqDto.getRefCustomField4()!=null && reqDto.getRefCustomFieldValue4()!=null){
            queryKey.put(reqDto.getRefCustomField4(),reqDto.getRefCustomFieldValue4());
        }

        if(reqDto.getRefCustomField5()!=null && reqDto.getRefCustomFieldValue5()!=null){
            queryKey.put(reqDto.getRefCustomField5(),reqDto.getRefCustomFieldValue5());
        }

        if(reqDto.getRefCustomField6()!=null && reqDto.getRefCustomFieldValue6()!=null){
            queryKey.put(reqDto.getRefCustomField6(),reqDto.getRefCustomFieldValue6());
        }

        if(reqDto.getRefCustomField7()!=null && reqDto.getRefCustomFieldValue7()!=null){
            queryKey.put(reqDto.getRefCustomField7(),reqDto.getRefCustomFieldValue7());
        }

        if(reqDto.getRefCustomField8()!=null && reqDto.getRefCustomFieldValue8()!=null){
            queryKey.put(reqDto.getRefCustomField8(),reqDto.getRefCustomFieldValue8());
        }

        currentData.forEach(item -> {
            JSONObject jsonObject = (JSONObject) item;
            boolean bFlag = true;
            for(Map.Entry<String,String> one : queryKey.entrySet()) {
                if (!jsonObject.containsKey(one.getKey())) {
                    bFlag = false;
                    break;
                }else{
                    Object value = jsonObject.get(one.getKey());
                    String strValue = String.valueOf(value);
                    if(!strValue.equals(one.getValue())){
                        bFlag = false;
                        break;
                    }
                }
            }

            if(bFlag){
                QueryRefRedisBusinessDataDetailRespDto elm = new QueryRefRedisBusinessDataDetailRespDto();
                for(RedisBusinessDataResDto one : reqDto.getRedisBusinessDataResList()){
                    Object value = jsonObject.get(one.getFieldName());
                    Field field = fieldIndex.get(one.getMapFieldName());
                    if(value!=null){
                        try {
                            field.set(elm,String.valueOf(value));
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        }
                    }
                }
                collectList.add(elm);
            }
        });
        if(CollectionUtil.isNotEmpty(collectList)){
            if(reqDto.getRedisParamSortType()!=null && reqDto.getRedisParamSortType().equals("ASC")){
                return collectList.get(0);
            }else if(reqDto.getRedisParamSortType()!=null && reqDto.getRedisParamSortType().equals("DSC")){
                return collectList.get(collectList.size()-1);
            }
        }else{
            return new QueryRefRedisBusinessDataDetailRespDto();
        }
        return collectList.get(0);
    }
/**
      * code:addMemoryBusinessData
      * name:M2新增内存业务数据（特殊方法）
      * desc:undefined
      * gen by moon at 3/15/2024, 8:49:52 PM
      *
      **/
     @Trace(operationName = "M2新增内存业务数据（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddMemoryBusinessDataRespDto addMemoryBusinessData(AddMemoryBusinessDataReqDto reqDto) {
         String key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         JSONObject objectData = new JSONObject();
         for(MemoryBusinessDataDto one : reqDto.getMemoryBusinessDataList()){
             objectData.put(one.getFieldName(),one.getFieldValue());
         }
         if(reqDto.getIsDataList().equals("TRUE")){
             Object currentData = CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().get(key);
             if(currentData!=null){
                 if(currentData instanceof JSONArray){
                     JSONArray arrayData = (JSONArray)currentData;
                     arrayData.add(objectData);
                     CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,arrayData);
                 }else{
                     throw new BizException("-1","想取数据集，但是存的是对象",false);
                 }
             }else{
                 JSONArray arrayData = new JSONArray();
                 arrayData.add(objectData);
                 CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,arrayData);
             }
         }else{
             CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,objectData);
         }
         return new AddMemoryBusinessDataRespDto();
      }
/**
      * code:queryMemoryBusinessData
      * name:M2查询内存业务数据详情（特殊方法）
      * desc:undefined
      * gen by moon at 3/15/2024, 8:50:11 PM
      *
      **/
     @Trace(operationName = "M2查询内存业务数据详情（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryMemoryBusinessDataDetailRespDto queryMemoryBusinessDataDetail(QueryMemoryBusinessDataDetailReqDto reqDto) {
       // TODO ruizhe skai dong ; 3/15/2024, 8:50:11 PM
        return new QueryMemoryBusinessDataDetailRespDto();
      }
/**
      * code:collectionsAggregation
      * name:M2执行数据集聚合
      * desc:undefined
      * gen by moon at 3/16/2024, 11:18:38 PM
      *
      **/
     @Trace(operationName = "M2执行数据集聚合")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDatasetAggregationRespDto implementDatasetAggregation(ImplementDatasetAggregationReqDto reqDto) {
         ImplementDatasetAggregationRespDto retData = new ImplementDatasetAggregationRespDto();
         retData.getCollectionsAggregationList().addAll(reqDto.getDataSetsListOne().stream().map(p->BeanUtil.toBean(p,CollectionsAggregationDto.class)).collect(Collectors.toList()));
         retData.getCollectionsAggregationList().addAll(reqDto.getDataSetsListTwo().stream().map(p->BeanUtil.toBean(p,CollectionsAggregationDto.class)).collect(Collectors.toList()));
        return retData;
      }
/**
      * code:dataRedistribution
      * name:M2执行数据重分配（特殊方法）
      * desc:undefined
      * gen by moon at 3/17/2024, 8:28:10 PM
      *
      **/
     @Trace(operationName = "M2执行数据重分配（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDataRedistributionRespDto implementDataRedistribution(ImplementDataRedistributionReqDto reqDto) {
         ImplementDataRedistributionRespDto retData = new ImplementDataRedistributionRespDto();


         Map<String,String> dataInfo = new HashMap<>();
//         dataInfo.put("汇报得分_主客观得分权重原始",reqDto.getReportScoreSubAndObjWeightOri());
//         dataInfo.put("汇报得分_过程中期权重原始",reqDto.getProcessReportScoreProMidWeightOri());
//         dataInfo.put("汇报得分_中期得分权重原始",reqDto.getProcessReportScoreMidWeightOri());
//         dataInfo.put("汇报得分_汇报平均分权重原始",reqDto.getProcessReportScoreAvgWeightOri());

         dataInfo.put("汇报得分_主客观得分权重变化",String.valueOf(reqDto.getReportScoreSubAndObjWeightChg()));
         dataInfo.put("汇报得分_过程中期权重变化",String.valueOf(reqDto.getProcessReportScoreProMidWeightChg()));
         dataInfo.put("汇报得分_中期得分权重变化",String.valueOf(reqDto.getProcessReportScoreMidWeightChg()));
         dataInfo.put("汇报得分_汇报平均分权重变化",String.valueOf(reqDto.getProcessReportScoreAvgWeightChg()));

         List<String> zeroList = new ArrayList<>();
         List<String> nonZeroList = new ArrayList<>();
         //分类，变化值 0和非0的
         for(Map.Entry<String,String> one : dataInfo.entrySet()){
             if(one.getKey().endsWith("变化")){
                 if(one.getValue()==null || one.getValue().equals("null") ||Double.valueOf(one.getValue()).doubleValue() == 0d){
                     zeroList.add(one.getKey());
                 }else{
                     nonZeroList.add(one.getKey());
                 }
             }
         }

         if(nonZeroList.size()==4){
             retData.setReportScoreSubAndObjWeight(Double.valueOf(dataInfo.get("汇报得分_主客观得分权重变化")));
             retData.setProcessReportScoreProMidWeight(Double.valueOf(dataInfo.get("汇报得分_过程中期权重变化")));
             retData.setProcessReportScoreMidWeight(Double.valueOf(dataInfo.get("汇报得分_中期得分权重变化")));
             retData.setProcessReportScoreAvgWeight(Double.valueOf(dataInfo.get("汇报得分_汇报平均分权重变化")));
             return retData;
         }

         if(zeroList.size()==4){
             retData.setReportScoreSubAndObjWeight(0d);
             retData.setProcessReportScoreProMidWeight(0d);
             retData.setProcessReportScoreMidWeight(0d);
             retData.setProcessReportScoreAvgWeight(0d);
             return retData;
         }

         int mode = BigDecimal.ROUND_DOWN;
         Map<String,String> paramInfo = new HashMap<>();
         BigDecimal currentTotal = new BigDecimal("0");
         for(String one : nonZeroList){
             BigDecimal elmData = new BigDecimal(dataInfo.get(one));
             currentTotal = currentTotal.add(elmData);
         }

         for(String one : nonZeroList){
             BigDecimal fenzi = new BigDecimal(dataInfo.get(one));
             paramInfo.put(one,String.valueOf(fenzi.divide(currentTotal,10,mode)));
         }

         BigDecimal waiteTotal = new BigDecimal(String.valueOf(reqDto.getWeightTotal()));



         BigDecimal lastTotal = new BigDecimal("0");
         int index = nonZeroList.size();
         for(String one : nonZeroList){
             BigDecimal oneResult = new BigDecimal("0");
             index--;
             if(index==0){
                 //最后第一个
                 oneResult = waiteTotal.subtract(lastTotal);
             }else{

                 BigDecimal bili = new BigDecimal(paramInfo.get(one));
                 BigDecimal tmp = bili.multiply(waiteTotal);
                 oneResult = tmp.setScale(10,mode);
                 lastTotal = lastTotal.add(oneResult);
             }

             if(one.equals("汇报得分_主客观得分权重变化")){
                 retData.setReportScoreSubAndObjWeight(oneResult.doubleValue());
             }else if(one.equals("汇报得分_过程中期权重变化")){
                 retData.setProcessReportScoreProMidWeight(oneResult.doubleValue());
             }else if(one.equals("汇报得分_中期得分权重变化")){
                 retData.setProcessReportScoreMidWeight(oneResult.doubleValue());
             }else if(one.equals("汇报得分_汇报平均分权重变化")){
                 retData.setProcessReportScoreAvgWeight(oneResult.doubleValue());
             }
         }

         for(String one : zeroList){
             if(one.equals("汇报得分_主客观得分权重变化")){
                 retData.setReportScoreSubAndObjWeight(0d);
             }else if(one.equals("汇报得分_过程中期权重变化")){
                 retData.setProcessReportScoreProMidWeight(0d);
             }else if(one.equals("汇报得分_中期得分权重变化")){
                 retData.setProcessReportScoreMidWeight(0d);
             }else if(one.equals("汇报得分_汇报平均分权重变化")){
                 retData.setProcessReportScoreAvgWeight(0d);
             }
         }




        return retData;
      }
/**
      * code:receptionService
      * name:M2接收字段
      * desc:undefined
      * gen by moon at 3/17/2024, 8:28:27 PM
      *
      **/
     @Trace(operationName = "M2接收字段")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementSmartSessionReceiveFieldInputRespDto implementSmartSessionReceiveFieldInput(ImplementSmartSessionReceiveFieldInputReqDto reqDto) {
         return BeanUtil.toBean(reqDto,ImplementSmartSessionReceiveFieldInputRespDto.class);
      }
/**
      * code:receptionService
      * name:M2生成数据对象批次标识
      * desc:undefined
      * gen by moon at 4/18/2024, 10:33:24 PM
      *
      **/
     @Trace(operationName = "M2生成数据对象批次标识")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTenReceivingFieldRespDto implementTenReceivingField(ImplementTenReceivingFieldReqDto reqDto) {
         ImplementTenReceivingFieldRespDto retData = new ImplementTenReceivingFieldRespDto();
         retData.setDataObjectBatchCode(reqDto.getDataObjectBatchCode()+CommonFunctionHelper.getUid());
         return retData;
      }
/**
      * code:updateRedisBusinessData
      * name:M2修改redis业务数据对象
      * desc:undefined
      * gen by moon at 4/18/2024, 10:33:44 PM
      *
      **/
     @Trace(operationName = "M2修改redis业务数据对象")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public UpdateRedisBusinessDataRespDto updateRedisBusinessData(UpdateRedisBusinessDataReqDto reqDto) {
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         if(reqDto.getRedisDataObjectCatalogue()!=null){
             key = reqDto.getRedisDataObjectCatalogue() + ":" + key;
         }
         if( (reqDto.getIsDataList()!=null && reqDto.getIsDataList().equals("FALSE")) || (reqDto.getIsDataList()==null)){
             JSONObject currentData = (JSONObject)redisUtil.get(key);
             for(FieldDataDto oneField : reqDto.getFieldDataList()){
                 currentData.put(oneField.getFieldName(),oneField.getFieldValue());
             }
             redisUtil.set(key,currentData);
         }else{
             JSONArray currentData = (JSONArray)redisUtil.get(key);
             if(currentData==null || currentData.size()==0){
                 return new UpdateRedisBusinessDataRespDto();
             }

             Map<String,Field> fieldIndex = new HashMap<>();
             Field[] fields = QueryRefRedisBusinessDataDetailRespDto.class.getDeclaredFields();
             for(Field one : fields){
                 one.setAccessible(true);
                 fieldIndex.put(one.getName(),one);
             }

             Map<String,String> queryKey = new HashMap<>();
             if(reqDto.getRefCustomField1()!=null && reqDto.getRefCustomFieldValue1()!=null){
                 queryKey.put(reqDto.getRefCustomField1(),reqDto.getRefCustomFieldValue1());
             }

             if(reqDto.getRefCustomField2()!=null && reqDto.getRefCustomFieldValue2()!=null){
                 queryKey.put(reqDto.getRefCustomField2(),reqDto.getRefCustomFieldValue2());
             }

             if(reqDto.getRefCustomField3()!=null && reqDto.getRefCustomFieldValue3()!=null){
                 queryKey.put(reqDto.getRefCustomField3(),reqDto.getRefCustomFieldValue3());
             }

             if(reqDto.getRefCustomField4()!=null && reqDto.getRefCustomFieldValue4()!=null){
                 queryKey.put(reqDto.getRefCustomField4(),reqDto.getRefCustomFieldValue4());
             }

             if(reqDto.getRefCustomField5()!=null && reqDto.getRefCustomFieldValue5()!=null){
                 queryKey.put(reqDto.getRefCustomField5(),reqDto.getRefCustomFieldValue5());
             }

             if(reqDto.getRefCustomField6()!=null && reqDto.getRefCustomFieldValue6()!=null){
                 queryKey.put(reqDto.getRefCustomField6(),reqDto.getRefCustomFieldValue6());
             }

             for(int i =0;i< currentData.size(); i++){
                 JSONObject jsonObject = currentData.getJSONObject(i);
                 boolean bFlag = true;
                 for(Map.Entry<String,String> one : queryKey.entrySet()) {
                     if (!jsonObject.containsKey(one.getKey())) {
                         bFlag = false;
                         break;
                     }else{
                         Object value = jsonObject.get(one.getKey());
                         String strValue = String.valueOf(value);
                         if(!strValue.equals(one.getValue())){
                             bFlag = false;
                             break;
                         }
                     }
                 }

                 if(bFlag){
                     for(FieldDataDto oneField : reqDto.getFieldDataList()){
                         jsonObject.put(oneField.getFieldName(),oneField.getFieldValue());
                     }
                 }
             }
             redisUtil.set(key,currentData);
         }

        return new UpdateRedisBusinessDataRespDto();
      }
/**
      * code:newestOfMultipleNum
      * name:M2执行数据集取最新一条（特殊方法）
      * desc:undefined
      * gen by moon at 4/18/2024, 10:34:21 PM
      *
      **/
     @Trace(operationName = "M2执行数据集取最新一条（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDatasSetFetchNewLatestRespDto implementDatasSetFetchNewLatest(ImplementDatasSetFetchNewLatestReqDto reqDto) {
       // TODO ruizhe skai dong ; 4/18/2024, 10:34:21 PM
        return new ImplementDatasSetFetchNewLatestRespDto();
      }
/**
      * code:newestOfMultipleNum
      * name:M2执行数据集取最后一条（特殊方法）
      * desc:undefined
      * gen by moon at 4/23/2024, 3:04:22 AM
      *
      **/
     @Trace(operationName = "M2执行数据集取最后一条（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDatasSetFetchLastLatestRespDto implementDatasSetFetchLastLatest(ImplementDatasSetFetchLastLatestReqDto reqDto) {
         ImplementDatasSetFetchLastLatestRespDto retData = new ImplementDatasSetFetchLastLatestRespDto();
         if(CollectionUtil.isNotEmpty(reqDto.getBusinessDataSetList())){
             BusinessDataSetDto lastData = reqDto.getBusinessDataSetList().get(reqDto.getBusinessDataSetList().size()-1);
             retData.setCommPrimaryKey(lastData.getCustomField1());
         }
         return retData;
      }
/**
      * code:aDatasLoopVagueMateAssignBdatasResult
      * name:M2两数据集模糊匹配指定字段数据集结果（特殊方法）
      * desc:undefined
      * gen by moon at 5/11/2024, 11:16:16 PM
      *
      **/
     @Trace(operationName = "M2两数据集模糊匹配指定字段数据集结果（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTwoDatasVagueMateAssignDatasResultRespDto implementTwoDatasVagueMateAssignDatasResult(ImplementTwoDatasVagueMateAssignDatasResultReqDto reqDto) {
         ImplementTwoDatasVagueMateAssignDatasResultRespDto retData = new ImplementTwoDatasVagueMateAssignDatasResultRespDto();
         List<String> index = new ArrayList<>();
         for(String one : reqDto.getDataSetsListOne()){
             for(DataSetsListTwoDto two : reqDto.getDataSetsListTwo()){
                 if(two.getAssignMateField()!=null && two.getAssignMateField().contains(one)){
                     ComDatasDto elm = new ComDatasDto();
                     BeanUtil.copyProperties(two,elm);
                     String dupKey = "";
                     if(two.getCustomField1()!=null){
                         dupKey = dupKey + "_" +two.getCustomField1();
                     }

                     if(two.getCustomField2()!=null){
                         dupKey = dupKey + "_" +two.getCustomField2();
                     }

                     if(two.getCustomField3()!=null){
                         dupKey = dupKey + "_" +two.getCustomField3();
                     }

                     if(two.getCustomField4()!=null){
                         dupKey = dupKey + "_" +two.getCustomField4();
                     }

                     if(two.getCustomField5()!=null){
                         dupKey = dupKey + "_" +two.getCustomField5();
                     }

                     if(two.getCustomField6()!=null){
                         dupKey = dupKey + "_" +two.getCustomField6();
                     }
                     if(!index.contains(dupKey)){
                         retData.getComDatasList().add(elm);
                         index.add(dupKey);
                     }
                 }
             }
         }
        return retData;
      }
/**
      * code:textFieldAssignFormatTurnDatas
      * name:M2执行文本字段指定格式转数据集（特殊方法）
      * desc:undefined
      * gen by moon at 5/11/2024, 11:16:36 PM
      *
      **/
     @Trace(operationName = "M2执行文本字段指定格式转数据集（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTextFieldAssignFormatTurnDatasRespDto implementTextFieldAssignFormatTurnDatas(ImplementTextFieldAssignFormatTurnDatasReqDto reqDto) {
         ImplementTextFieldAssignFormatTurnDatasRespDto retData = new ImplementTextFieldAssignFormatTurnDatasRespDto();
         String[] splitor = reqDto.getCustomField().split(reqDto.getSeparator());
         if(splitor!=null && splitor.length>0){
             for(String one : splitor){
                 retData.getComDatasList().add(one);
             }
         }
        return retData;
      }
/**
      * code:outPutCurrentTreeOrderNumber
      * name:M2输出当前树排序值(公共)
      * desc:undefined
      * gen by moon at 5/17/2024, 1:45:46 AM
      *
      **/
     @Trace(operationName = "M2输出当前树排序值(公共)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainOutPutCurrentTreeOrderNumberComRespDto obtainOutPutCurrentTreeOrderNumberCom(ObtainOutPutCurrentTreeOrderNumberComReqDto reqDto) {
         ObtainOutPutCurrentTreeOrderNumberComRespDto retData = new ObtainOutPutCurrentTreeOrderNumberComRespDto();
         Long baseCode = 100L;
         baseCode = baseCode + reqDto.getOrderNumber();
         String baseCodeStr = String.valueOf(baseCode);
         String result = reqDto.getSuperiorsTreeOrderNumbeir() + baseCodeStr;
         retData.setTreeOrderNumbeir(result);
         return retData;
      }
/**
      * code:publicFieldCache
      * name:M2执行空间配置推送内容（特殊方法）
      * desc:undefined
      * gen by moon at 5/18/2024, 7:24:20 PM
      *
      **/
     @Trace(operationName = "M2执行空间配置推送内容（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementSpaceConfPushMemoryRespDto implementSpaceConfPushMemory(ImplementSpaceConfPushMemoryReqDto reqDto) {
       // TODO ruizhe skai dong ; 5/18/2024, 7:24:20 PM
        return new ImplementSpaceConfPushMemoryRespDto();
      }

       @Trace(operationName = "M2执行并发行为主题锁(悬停等待)-执行锁")
       @Tags({@Tag(key = "参数",value = "arg[0]"),
        @Tag(key = "返回值",value = "returnedObj")})
      public boolean excuteLock(String lockKey,Long duration){
          boolean bRet = redisUtil.getLock(lockKey,lockKey,duration);
          return bRet;
      }

/**
      * code:receptionService
      * name:M2执行并发行为主题锁(悬停等待)
      * desc:undefined
      * gen by moon at 6/1/2024, 10:42:18 AM
      *
      **/
     @Trace(operationName = "M2执行并发行为主题锁(悬停等待)")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementConcurrencyBehaviorThemeLockWaitRespDto implementConcurrencyBehaviorThemeLockWait(ImplementConcurrencyBehaviorThemeLockWaitReqDto reqDto) {
         ImplementConcurrencyBehaviorThemeLockWaitRespDto retData = new ImplementConcurrencyBehaviorThemeLockWaitRespDto();
         retData.setPreventConcurrentLockingSituations("CONCURRENT_LOCK_FAILURE");
         String lockKeyPrefix = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             lockKeyPrefix = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             lockKeyPrefix = reqDto.getBusinessDataObject();
         }




         if(reqDto.getRedisDataObjectCatalogue()!=null){
             lockKeyPrefix = reqDto.getRedisDataObjectCatalogue() + ":" + lockKeyPrefix;
         }

         Long duration = null;
         if(reqDto.getTimeUnitType()!=null && reqDto.getDuration()!=null){
             duration = DateTimeUtil.getSecond(reqDto.getTimeUnitType(),reqDto.getDuration());
         }


         long waiteCount = DateTimeUtil.getSecond(reqDto.getWaitTimeUnitType(),Long.valueOf(reqDto.getWaitingTime()));
         while (true){
             if(waiteCount==0l){
                 break;
             }
             boolean bLock = excuteLock(lockKeyPrefix,duration);
             if(bLock){
                 retData.setPreventConcurrentLockingSituations("EMPTY_LOCK_SUCCESSFUL");
                 break;
             }
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
             waiteCount--;
         }


         if(retData.getPreventConcurrentLockingSituations()!=null
            && retData.getPreventConcurrentLockingSituations().equals("EMPTY_LOCK_SUCCESSFUL")){
             if(!CommonFunctionHelper.checkBaseInfo()){
                 CommonFunctionHelper.setBaseInfoToLocal(new BaseInfoDO());
             }
             CommonFunctionHelper.getBaseInfoFromLocal().getLockList().add(lockKeyPrefix);
         }
         return retData;
      }
/**
      * code:addMemoryBusinessData
      * name:M2新增内存业务数据（特殊方法）
      * desc:undefined
      * gen by moon at 6/6/2024, 3:48:14 PM
      *
      **/
     @Trace(operationName = "M2新增内存业务数据（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddMemory2BusinessDataRespDto addMemory2BusinessData(AddMemory2BusinessDataReqDto reqDto) {
         String key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         JSONObject objectData = new JSONObject();
         for(MemoryBusinessDataDto one : reqDto.getMemoryBusinessDataList()){
             objectData.put(one.getFieldName(),one.getFieldValue());
         }
         if(reqDto.getIsDataList().equals("TRUE")){
             Object currentData = CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().get(key);
             if(currentData!=null){
                 if(currentData instanceof JSONArray){
                     JSONArray arrayData = (JSONArray)currentData;
                     arrayData.add(objectData);
                     CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,arrayData);
                 }else{
                     throw new BizException("-1","想取数据集，但是存的是对象",false);
                 }
             }else{
                 JSONArray arrayData = new JSONArray();
                 arrayData.add(objectData);
                 CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,arrayData);
             }
         }else{
             CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().put(key,objectData);
         }
         return new AddMemory2BusinessDataRespDto();
      }
/**
      * code:publicFieldCache
      * name:M2执行业务组件公共字段推送内存（特殊方法）
      * desc:undefined
      * gen by moon at 6/6/2024, 3:48:54 PM
      *
      **/
     @Trace(operationName = "M2执行业务组件公共字段推送内存（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementBizModuleAccessParameterFieldRespDto implementBizModuleAccessParameterField(ImplementBizModuleAccessParameterFieldReqDto reqDto) {
         BaseInfoDO domain = new BaseInfoDO();
         if(BaseInfoHolder.contextHolder.get()!=null){
             BeanUtil.copyProperties(BaseInfoHolder.contextHolder.get().getBaseInfo(),domain);
             BaseInfoHolder.contextHolder.remove();
         }
         if(reqDto.getSpaceId()!=null){
             domain.setSpecSpaceId(reqDto.getSpaceId());
         }

         if(reqDto.getCreateInductionId()!=null){
             domain.setSpecInductionRecordId(reqDto.getCreateInductionId());
         }

         if(reqDto.getAppId()!=null){
             domain.setSpecAppId(reqDto.getAppId());
         }

         CommonFunctionHelper.setBaseInfoToLocal(domain);
        return new ImplementBizModuleAccessParameterFieldRespDto();
      }
/**
      * code:timeFormatConversion
      * name:M2执行时间格式转换（特殊字段）
      * desc:undefined
      * gen by moon at 6/8/2024, 3:19:02 AM
      *
      **/
     @Trace(operationName = "M2执行时间格式转换（特殊字段）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementTimeFormatConversionRespDto implementTimeFormatConversion(ImplementTimeFormatConversionReqDto reqDto) {
         ImplementTimeFormatConversionRespDto retData = new ImplementTimeFormatConversionRespDto();
         // 输入日期格式
         SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
         // 输出日期格式
         SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date date = null;
         String outputDateStr = null;

         try {
             // 解析输入字符串为日期对象
             date = inputFormat.parse(reqDto.getComTxtField());
             // 格式化日期对象为输出格式的字符串
             outputDateStr = outputFormat.format(date);
             retData.setComTxtField(outputDateStr);
         } catch (ParseException e) {
             e.printStackTrace();
         }

        return retData;
      }
/**
      * code:dataSetFetchLast
      * name:M2执行数据集取最一条（含时间）（特殊方法）
      * desc:undefined
      * gen by moon at 6/9/2024, 3:59:16 PM
      *
      **/
     @Trace(operationName = "M2执行数据集取最一条（含时间）（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementDatasFetchLastLatestWithTimeRespDto implementDatasFetchLastLatestWithTime(ImplementDatasFetchLastLatestWithTimeReqDto reqDto) {
         ImplementDatasFetchLastLatestWithTimeRespDto retData = new ImplementDatasFetchLastLatestWithTimeRespDto();
         if(reqDto.getOrderSizeType().equals("FROM_LARGE_SMALL")){
             ComDatasDto target = reqDto.getComDatasList().get(reqDto.getComDatasList().size()-1);
             BeanUtil.copyProperties(target,retData);
        }else{
             ComDatasDto target = reqDto.getComDatasList().get(0);
             BeanUtil.copyProperties(target,retData);
        }
        return retData;
      }
/**
      * code:FILE_ADDRESS_ALL_PATH
      * name:M2执行单条相对地址转全路径（特殊方法）
      * desc:undefined
      * gen by moon at 6/15/2024, 4:49:08 PM
      *
      **/
     @Trace(operationName = "M2执行单条相对地址转全路径（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementSingleRelativePathConvertToFullPathRespDto implementSingleRelativePathConvertToFullPath(ImplementSingleRelativePathConvertToFullPathReqDto reqDto) {
         ImplementSingleRelativePathConvertToFullPathRespDto retData = new ImplementSingleRelativePathConvertToFullPathRespDto();
         retData.setFullPath(CommonFunctionHelper.getFilePath(reqDto.getRelativePath()));
        return retData;
      }
/**
      * code:queryMemoryBusinessDatas
      * name:M2查询内存业务数据列表（特殊方法）
      * desc:undefined
      * gen by moon at 12/6/2024, 10:03:17 PM
      * 
      **/
     @Trace(operationName = "M2查询内存业务数据列表（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryMemoryBusinessDataListRespDto queryMemoryBusinessDataList(QueryMemoryBusinessDataListReqDto reqDto) {
         QueryMemoryBusinessDataListRespDto retData = new QueryMemoryBusinessDataListRespDto();
         String key = null;
         if(reqDto.getDataObjectBatchCode()!=null){
             key = reqDto.getBusinessDataObject() + "_" +reqDto.getDataObjectBatchCode();
         }else{
             key = reqDto.getBusinessDataObject();
         }


         Object currentData = CommonFunctionHelper.getBaseInfoFromLocal().getLocalCachePool().get(key);
         JSONArray arrayData = null;
         if(currentData!=null){
             if(currentData instanceof JSONArray){
                 arrayData = (JSONArray)currentData;
             }else{
                 throw new BizException("-1","想取数据集，但是存的是对象",false);
             }
         }

         Map<String,Field> fieldIndex = new HashMap<>();
         Field[] fields = MemoryBusinessResDataDto.class.getDeclaredFields();
         for(Field one : fields){
             one.setAccessible(true);
             fieldIndex.put(one.getName(),one);
         }

         arrayData.forEach(item -> {
             MemoryBusinessResDataDto elm = new MemoryBusinessResDataDto();
             JSONObject jsonObject = (JSONObject) item;
             for(MemoryBusinessResDataDto one : reqDto.getMemoryBusinessResDataList()){
                 Object value = jsonObject.get(one.getFieldName());
                 Field field = fieldIndex.get(one.getFieldValue());
                 if(value!=null){
                     try {
                         field.set(elm,value);
                     } catch (IllegalAccessException e) {
                         e.printStackTrace();
                     }
                 }
             }
             retData.getMemoryBusinessResDataList().add(elm);
         });

         return retData;
      }
/**
      * code:mutiFieldToJsonString
      * name:M2执行多字段转json字符串（特殊方法）
      * desc:undefined
      * gen by moon at 12/8/2024, 3:22:57 AM
      *
      **/
     @Trace(operationName = "M2执行多字段转json字符串（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementMutFeldToJsonStringRespDto implementMutFeldToJsonString(ImplementMutFeldToJsonStringReqDto reqDto) {
         ImplementMutFeldToJsonStringRespDto retData = new ImplementMutFeldToJsonStringRespDto();
         JSONObject json = new JSONObject();
         if(reqDto.getCustomField1()!=null){
             json.put(reqDto.getCustomField1(),reqDto.getCustomFieldValue1());
         }

         if(reqDto.getCustomField2()!=null){
             json.put(reqDto.getCustomField2(),reqDto.getCustomFieldValue2());
         }

         if(reqDto.getCustomField3()!=null){
             json.put(reqDto.getCustomField3(),reqDto.getCustomFieldValue3());
         }

         if(reqDto.getCustomField4()!=null){
             json.put(reqDto.getCustomField4(),reqDto.getCustomFieldValue4());
         }

         if(reqDto.getCustomField5()!=null){
             json.put(reqDto.getCustomField5(),reqDto.getCustomFieldValue5());
         }

         if(reqDto.getCustomField6()!=null){
             json.put(reqDto.getCustomField6(),reqDto.getCustomFieldValue6());
         }

         if(reqDto.getCustomField7()!=null){
             json.put(reqDto.getCustomField7(),reqDto.getCustomFieldValue7());
         }

         if(reqDto.getCustomField8()!=null){
             json.put(reqDto.getCustomField8(),reqDto.getCustomFieldValue8());
         }

         if(reqDto.getCustomField9()!=null){
             json.put(reqDto.getCustomField9(),reqDto.getCustomFieldValue9());
         }

         if(reqDto.getCustomField10()!=null){
             json.put(reqDto.getCustomField10(),reqDto.getCustomFieldValue10());
         }
         retData.setCustomText(json.toJSONString());
        return retData;
      }
/**
      * code:addNodeGraphDatabase
      * name:M2新增节点（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:44:54 PM
      * 
      **/
     @Trace(operationName = "M2新增节点（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddNodeGraphDatabaseRespDto addNodeGraphDatabase(AddNodeGraphDatabaseReqDto reqDto) {
         AddNodeGraphDatabaseRespDto retData = new AddNodeGraphDatabaseRespDto();
         String nodeType = reqDto.getNodeType();
         NodeAttributeGraphDatabaseDto nodeIdAttr = new NodeAttributeGraphDatabaseDto();
         nodeIdAttr.setAttributeName("nodeId");
         retData.setNodeId(CommonFunctionHelper.getUid());
         nodeIdAttr.setAttributeValue(retData.getNodeId());

         NodeAttributeGraphDatabaseDto nodeTypeAttr = new NodeAttributeGraphDatabaseDto();
         nodeTypeAttr.setAttributeName("nodeType");
         nodeTypeAttr.setAttributeValue(nodeType);

         List<NodeAttributeGraphDatabaseDto> attributes = reqDto.getNodeAttributeGraphDatabaseList();
         attributes.add(nodeIdAttr);
         attributes.add(nodeTypeAttr);
         StringBuilder attributesBuilder = new StringBuilder();

         for (NodeAttributeGraphDatabaseDto attribute : attributes) {
             if (attributesBuilder.length() > 0) {
                 attributesBuilder.append(", ");
             }
             attributesBuilder.append(attribute.getAttributeName())
                     .append(": $")
                     .append(attribute.getAttributeName());
         }

         String query = "CREATE (n {" + attributesBuilder.toString() + "})";

         try (Session session = driver.session()) {
             session.run(query, attributes.stream().collect(Collectors.toMap(
                     NodeAttributeGraphDatabaseDto::getAttributeName,
                     attribute -> attribute.getAttributeValue()
             )));
         }
        return retData;
      }
/**
      * code:deleteNodeGraphDatabase
      * name:M2删除节点（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:45:17 PM
      * 
      **/
     @Trace(operationName = "M2删除节点（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public DeleteNodeGraphDatabaseRespDto deleteNodeGraphDatabase(DeleteNodeGraphDatabaseReqDto reqDto) {
         String query = "MATCH (n) WHERE n.nodeId = $nodeId DETACH DELETE n";

         Map<String,Object> param = new HashMap<>();
         try (Session session = driver.session()) {
             param.put("nodeId", reqDto.getNodeId());
             session.run(query, param);
         }
        return new DeleteNodeGraphDatabaseRespDto();
      }

    @Trace(operationName = "获取单个节点属性")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
      public Map<String,Object> getRecord(Record record){
          Map<String,Object> retData = new HashMap<>();
          List<String> keys = record.keys();

          if(CollectionUtil.isNotEmpty(keys)){
              NodeValue value = (NodeValue)record.get(keys.get(0));
              Map<String, Object> info = value.asMap();
              Iterable<String> lables = value.asNode().labels();
              if(info!=null && info.size()>0){
                  Map<String,Object> properInfo = new HashMap<>();
                  for(Map.Entry<String,Object> one : info.entrySet()){
                      if(one.getKey().equals("nodeId")){
                          retData.put("nodeId",(String)info.get("nodeId"));
                      }else if(one.getKey().equals("nodeType")){
                          retData.put("nodeType",(String)info.get("nodeType"));
                      }



                      if(one.getValue() instanceof Integer){
                          Integer tmp = (Integer)one.getValue();
                          properInfo.put(one.getKey(),String.valueOf(tmp));
                      }else if(one.getValue() instanceof Long){
                          Long tmp = (Long)one.getValue();
                          properInfo.put(one.getKey(),String.valueOf(tmp));
                      }else if(one.getValue() instanceof Date){
                          Date tmp = (Date)one.getValue();
                          properInfo.put(one.getKey(),String.valueOf(tmp));
                      }else{
                          properInfo.put(one.getKey(),(String)one.getValue());
                      }


                      retData.put("properInfo",properInfo);

                  }
              }
              retData.put("lables",lables);
          }
          return retData;
      }
/**
      * code:queryNodeDetailGraphDatabase
      * name:M2查询节点详情（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:45:37 PM
      * 
      **/
     @Trace(operationName = "M2查询节点详情（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryNodeGraphDatabaseDetailRespDto queryNodeGraphDatabaseDetail(QueryNodeGraphDatabaseDetailReqDto reqDto) {
         QueryNodeGraphDatabaseDetailRespDto retData = new QueryNodeGraphDatabaseDetailRespDto();
         StringBuilder query = new StringBuilder("MATCH (n) WHERE n.nodeId = $nodeId");

         if (reqDto.getNodeTagGraphDatabaseList() != null && !reqDto.getNodeTagGraphDatabaseList().isEmpty()) {
             query.append(" AND ");
             for (int i = 0; i < reqDto.getNodeTagGraphDatabaseList().size(); i++) {
                 if (i > 0) {
                     query.append(" AND ");
                 }
                 query.append("n:").append(reqDto.getNodeTagGraphDatabaseList().get(i));
             }
         }

         query.append(" RETURN n");
         Map<String,Object> param = new HashMap<>();
         param.put("nodeId", reqDto.getNodeId());



         try (Session session = driver.session()) {
             Result result = session.run(query.toString(), param);
             if (result.hasNext()) {
                 Record record = result.next();
                 Map<String,Object> recordInfo = getRecord(record);
                 retData.setNodeId((String)recordInfo.get("nodeId"));
                 retData.setNodeType((String)recordInfo.get("nodeType"));
                 Map<String,Object> properInfo = (Map<String,Object>)recordInfo.get("properInfo");
                 if(properInfo!=null
                     && properInfo.size()>0){
                     for(Map.Entry<String,Object> one : properInfo.entrySet()){
                         NodeAttributeGraphDatabaseDto elm = new NodeAttributeGraphDatabaseDto();
                         elm.setAttributeName(one.getKey());
                         elm.setAttributeValue((String)one.getValue());
                         retData.getNodeAttributeGraphDatabaseList().add(elm);
                     }

                 }

             }
         }
         return retData;
      }
/**
      * code:queryNodeListGraphDatabase
      * name:M2查询节点列表（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:46:07 PM
      * 
      **/
     @Trace(operationName = "M2查询节点列表（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryNodeGraphDatabaseListRespDto queryNodeGraphDatabaseList(QueryNodeGraphDatabaseListReqDto reqDto) {
         QueryNodeGraphDatabaseListRespDto retData = new QueryNodeGraphDatabaseListRespDto();
         StringBuilder query = new StringBuilder("MATCH (n)");
         if(reqDto.getRelationType()==null){



             if (reqDto.getNodeAttributeGraphDatabaseList() != null) {
                 boolean isFirst = true;
                 for (NodeAttributeGraphDatabaseDto attr : reqDto.getNodeAttributeGraphDatabaseList()) {
                     if (!isFirst) {
                         query.append(" AND ");
                     }else{
                         query.append(" WHERE ");
                     }
                     query.append("n.").append(attr.getAttributeName())
                             .append(" = $").append(attr.getAttributeName());
                     isFirst = false;
                 }
             }

             if (reqDto.getNodeTagGraphDatabaseList() != null) {
                 for (String tag : reqDto.getNodeTagGraphDatabaseList()) {
                     query.append(" AND n:").append(tag);
                 }
             }

             query.append(" RETURN n");

             Map<String, Object> parameters = new HashMap<>();
             if (reqDto.getNodeAttributeGraphDatabaseList() != null) {
                 for (NodeAttributeGraphDatabaseDto attr : reqDto.getNodeAttributeGraphDatabaseList()) {
                     parameters.put(attr.getAttributeName(), attr.getAttributeValue());
                 }
             }

             try (Session session = driver.session()) {
                 List<Record> records = session.run(query.toString(), parameters).list();
                 for (Record one : records) {
                     NodeGraphDatabaseDto nodeElm = new NodeGraphDatabaseDto();
                     retData.getNodeGraphDatabaseList().add(nodeElm);

                     // 获取记录中的所有键（属性名称）
                     Map<String, Object> recordInfo = getRecord(one);
                     nodeElm.setNodeId((String) recordInfo.get("nodeId"));
                     nodeElm.setNodeType((String) recordInfo.get("nodeType"));

                     Map<String, Object> properInfo = (Map<String, Object>) recordInfo.get("properInfo");
                     if (properInfo != null && properInfo.size() > 0) {
                         for (Map.Entry<String, Object> oneProper : properInfo.entrySet()) {
                             NodeAttributeGraphDatabaseDto elm = new NodeAttributeGraphDatabaseDto();
                             elm.setNodeId(nodeElm.getNodeId());
                             elm.setAttributeName(oneProper.getKey());
                             elm.setAttributeValue((String) oneProper.getValue());
                             retData.getNodeAttributeGraphDatabaseList().add(elm);
                         }
                     }
                 }
             }
             return retData;
         }else{
             if(reqDto.getRelationType()!=null
                     && CollectionUtil.isEmpty(reqDto.getNodeTagGraphDatabaseList())
                     && CollectionUtil.isEmpty(reqDto.getNodeAttributeGraphDatabaseList())){
                 if (reqDto.getRelationType() != null) {
                     if(reqDto.getRelationDirection() != null
                             && reqDto.getRelationDirection().toUpperCase().equals("INCOMING")){
                         query.append("<-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }else{
                         query.append("-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }

                 }

                 if (reqDto.getRelationDirection() != null && reqDto.getRelationType() != null) {
                     String direction = reqDto.getRelationDirection().toUpperCase();
                     switch (direction) {
                         case "INCOMING":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         case "OUTCOMING":
                             query.append("->(m)"); // 添加节点m以匹配关系
                             break;
                         case "BOTH":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         default:
                             // 忽略无效的方向
                             break;
                     }
                 }

                 query.append(" RETURN n");

                 try (Session session = driver.session()) {
                     List<Record> records = session.run(query.toString()).list();
                     for (Record one : records) {
                         NodeGraphDatabaseDto nodeElm = new NodeGraphDatabaseDto();
                         retData.getNodeGraphDatabaseList().add(nodeElm);

                         // 获取记录中的所有键（属性名称）
                         Map<String, Object> recordInfo = getRecord(one);
                         nodeElm.setNodeId((String) recordInfo.get("nodeId"));
                         nodeElm.setNodeType((String) recordInfo.get("nodeType"));

                         Map<String, Object> properInfo = (Map<String, Object>) recordInfo.get("properInfo");
                         if (properInfo != null && properInfo.size() > 0) {
                             for (Map.Entry<String, Object> oneProper : properInfo.entrySet()) {
                                 NodeAttributeGraphDatabaseDto elm = new NodeAttributeGraphDatabaseDto();
                                 elm.setNodeId(nodeElm.getNodeId());
                                 elm.setAttributeName(oneProper.getKey());
                                 elm.setAttributeValue((String) oneProper.getValue());
                                 retData.getNodeAttributeGraphDatabaseList().add(elm);
                             }
                         }
                     }
                 }

             }

             if(reqDto.getRelationType()!=null
                     && CollectionUtil.isNotEmpty(reqDto.getNodeTagGraphDatabaseList())
                     && CollectionUtil.isEmpty(reqDto.getNodeAttributeGraphDatabaseList())){
                 query.append(" WHERE n");

                 String labels = reqDto.getNodeTagGraphDatabaseList().stream()
                         .collect(Collectors.joining("|"));
                 if (!labels.isEmpty()) {
                     query.append(":");
                     query.append(labels.replace("|", ": "));
                 }

                 query.append(" WITH n MATCH (n)");

                 if (reqDto.getRelationType() != null) {
                     if(reqDto.getRelationDirection() != null
                             && reqDto.getRelationDirection().toUpperCase().equals("INCOMING")){
                         query.append("<-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }else{
                         query.append("-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }

                 }

                 if (reqDto.getRelationDirection() != null && reqDto.getRelationType() != null) {
                     String direction = reqDto.getRelationDirection().toUpperCase();
                     switch (direction) {
                         case "INCOMING":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         case "OUTCOMING":
                             query.append("->(m)"); // 添加节点m以匹配关系
                             break;
                         case "BOTH":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         default:
                             // 忽略无效的方向
                             break;
                     }
                 }

                 query.append(" RETURN n");

                 try (Session session = driver.session()) {
                     List<Record> records = session.run(query.toString()).list();
                     for (Record one : records) {
                         NodeGraphDatabaseDto nodeElm = new NodeGraphDatabaseDto();
                         retData.getNodeGraphDatabaseList().add(nodeElm);

                         // 获取记录中的所有键（属性名称）
                         Map<String, Object> recordInfo = getRecord(one);
                         nodeElm.setNodeId((String) recordInfo.get("nodeId"));
                         nodeElm.setNodeType((String) recordInfo.get("nodeType"));

                         Map<String, Object> properInfo = (Map<String, Object>) recordInfo.get("properInfo");
                         if (properInfo != null && properInfo.size() > 0) {
                             for (Map.Entry<String, Object> oneProper : properInfo.entrySet()) {
                                 NodeAttributeGraphDatabaseDto elm = new NodeAttributeGraphDatabaseDto();
                                 elm.setNodeId(nodeElm.getNodeId());
                                 elm.setAttributeName(oneProper.getKey());
                                 elm.setAttributeValue((String) oneProper.getValue());
                                 retData.getNodeAttributeGraphDatabaseList().add(elm);
                             }
                         }
                     }
                 }

             }

             if(reqDto.getRelationType()!=null
                     && CollectionUtil.isNotEmpty(reqDto.getNodeTagGraphDatabaseList())
                     && CollectionUtil.isNotEmpty(reqDto.getNodeAttributeGraphDatabaseList())){
                 query.append(" WHERE n");

                 String labels = reqDto.getNodeTagGraphDatabaseList().stream()
                         .collect(Collectors.joining("|"));
                 if (!labels.isEmpty()) {
                     query.append(":");
                     query.append(labels.replace("|", ": "));
                 }

                 query.append(" AND ");

                 if (reqDto.getNodeAttributeGraphDatabaseList() != null) {
                     boolean isFirst = true;
                     for (NodeAttributeGraphDatabaseDto attr : reqDto.getNodeAttributeGraphDatabaseList()) {
                         if (!isFirst) {
                             query.append(" AND ");
                         }
                         query.append("n.").append(attr.getAttributeName())
                                 .append(" = $").append(attr.getAttributeName());
                         isFirst = false;
                     }
                 }



                 query.append(" WITH n MATCH (n)");

                 if (reqDto.getRelationType() != null) {
                     if(reqDto.getRelationDirection() != null
                             && reqDto.getRelationDirection().toUpperCase().equals("INCOMING")){
                         query.append("<-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }else{
                         query.append("-[r:").append(reqDto.getRelationType()).append("]"); // 确保关系类型使用反引号
                     }

                 }

                 if (reqDto.getRelationDirection() != null && reqDto.getRelationType() != null) {
                     String direction = reqDto.getRelationDirection().toUpperCase();
                     switch (direction) {
                         case "INCOMING":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         case "OUTCOMING":
                             query.append("->(m)"); // 添加节点m以匹配关系
                             break;
                         case "BOTH":
                             query.append("-(m)"); // 添加节点m以匹配关系
                             break;
                         default:
                             // 忽略无效的方向
                             break;
                     }
                 }

                 query.append(" RETURN n");

                 Map<String, Object> parameters = new HashMap<>();
                 if (reqDto.getNodeAttributeGraphDatabaseList() != null) {
                     for (NodeAttributeGraphDatabaseDto attr : reqDto.getNodeAttributeGraphDatabaseList()) {
                         parameters.put(attr.getAttributeName(), attr.getAttributeValue());
                     }
                 }

                 try (Session session = driver.session()) {
                     List<Record> records = session.run(query.toString(),parameters).list();
                     for (Record one : records) {
                         NodeGraphDatabaseDto nodeElm = new NodeGraphDatabaseDto();
                         retData.getNodeGraphDatabaseList().add(nodeElm);

                         // 获取记录中的所有键（属性名称）
                         Map<String, Object> recordInfo = getRecord(one);
                         nodeElm.setNodeId((String) recordInfo.get("nodeId"));
                         nodeElm.setNodeType((String) recordInfo.get("nodeType"));

                         Map<String, Object> properInfo = (Map<String, Object>) recordInfo.get("properInfo");
                         if (properInfo != null && properInfo.size() > 0) {
                             for (Map.Entry<String, Object> oneProper : properInfo.entrySet()) {
                                 NodeAttributeGraphDatabaseDto elm = new NodeAttributeGraphDatabaseDto();
                                 elm.setNodeId(nodeElm.getNodeId());
                                 elm.setAttributeName(oneProper.getKey());
                                 elm.setAttributeValue((String) oneProper.getValue());
                                 retData.getNodeAttributeGraphDatabaseList().add(elm);
                             }
                         }
                     }
                 }

             }

             return retData;
         }


      }
/**
      * code:addNodeTagGraphDatabase
      * name:M2新增节点标签（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:46:30 PM
      * 
      **/
     @Trace(operationName = "M2新增节点标签（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddNodeTagGraphDatabaseRespDto addNodeTagGraphDatabase(AddNodeTagGraphDatabaseReqDto reqDto) {
         String query = "MATCH (n) WHERE n.nodeId = $nodeId SET n:" + reqDto.getTagName();
         Map<String,Object> param = new HashMap<>();
         param.put("nodeId",reqDto.getNodeId());
         try (Session session = driver.session()) {
             session.run(query, param);
         }
        return new AddNodeTagGraphDatabaseRespDto();
      }
/**
      * code:batchAddNodeTagsGraphDatabase
      * name:M2批量增节点标签（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:46:50 PM
      * 
      **/
     @Trace(operationName = "M2批量增节点标签（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public BatchAddNodeTagGraphDatabaseRespDto batchAddNodeTagGraphDatabase(BatchAddNodeTagGraphDatabaseReqDto reqDto) {
         if (reqDto.getNodeTagGraphDatabaseList() == null || reqDto.getNodeTagGraphDatabaseList().isEmpty()) {
             return new BatchAddNodeTagGraphDatabaseRespDto();
         }

         StringBuilder query = new StringBuilder("MATCH (n) WHERE n.nodeId = $nodeId SET n:" + reqDto.getNodeTagGraphDatabaseList().get(0));
         for (int i = 1; i < reqDto.getNodeTagGraphDatabaseList().size(); i++) {
             query.append(", n:").append(reqDto.getNodeTagGraphDatabaseList().get(i));
         }

         Map<String,Object> param = new HashMap<>();
         param.put("nodeId",reqDto.getNodeId());
         try (Session session = driver.session()) {
             session.run(query.toString(), param);
         }
        return new BatchAddNodeTagGraphDatabaseRespDto();
      }
/**
      * code:deleteNodeGraphDatabase
      * name:M2删除节点标签（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:47:10 PM
      * 
      **/
     @Trace(operationName = "M2删除节点标签（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public DeleteNodeTagGraphDatabaseRespDto deleteNodeTagGraphDatabase(DeleteNodeTagGraphDatabaseReqDto reqDto) {
         String query = "MATCH (n) WHERE n.nodeId = $nodeId ";
         query += " REMOVE n:" + reqDto.getTagName(); // 使用REMOVE语句来移除标签

         Map<String, Object> param = new HashMap<>();
         param.put("nodeId", reqDto.getNodeId());

         try (Session session = driver.session()) {
             session.run(query, param);
         } catch (Exception e) {
             // 处理异常，例如记录日志或抛出自定义异常
             e.printStackTrace();
             throw new BizException("false",e,false);
         }
         return new DeleteNodeTagGraphDatabaseRespDto();
      }
/**
      * code:deleteNodeTagGraphDatabase
      * name:M2批量删节点标签（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:47:31 PM
      * 
      **/
     @Trace(operationName = "M2批量删节点标签（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public BatchDeleteNodeTagGraphDatabaseRespDto batchDeleteNodeTagGraphDatabase(BatchDeleteNodeTagGraphDatabaseReqDto reqDto) {
         List<String> tagNames = reqDto.getNodeTagGraphDatabaseList();
         if ( tagNames == null || tagNames.isEmpty()) {
             return new BatchDeleteNodeTagGraphDatabaseRespDto();
         }

         StringBuilder query = new StringBuilder("MATCH (n) WHERE n.nodeId = $nodeId ");
         for (int i = 0; i < tagNames.size(); i++) {
             if (i == 0) {
                 query.append("REMOVE n:");
             }
             if(i==tagNames.size()-1){
                 query.append(tagNames.get(i));
             }else{
                 query.append(tagNames.get(i)).append(":");
             }

         }

         Map<String,Object> param = new HashMap<>();
         param.put("nodeId",reqDto.getNodeId());
         try (Session session = driver.session()) {
             session.run(query.toString(), param);
         }
        return new BatchDeleteNodeTagGraphDatabaseRespDto();
      }
/**
      * code:addNodeRelationGraphDatabase
      * name:M2新增节点关系（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:47:57 PM
      * 
      **/
     @Trace(operationName = "M2新增节点关系（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddNodeRelationGraphDatabaseRespDto addNodeRelationGraphDatabase(AddNodeRelationGraphDatabaseReqDto reqDto) {
         String query = "MATCH (a), (b) WHERE a.nodeId = $nodeId AND b.nodeId = $relationNodeId ";
         query += "CREATE ";
         if (reqDto.getRelationDirection() != null && reqDto.getRelationDirection().equalsIgnoreCase("INCOMING")) {
             query += "(b)-[r:" + reqDto.getRelationType() + " {";
         } else {
             query += "(a)-[r:" + reqDto.getRelationType() + " {";
         }

         for (NodeRelationAttrGraphDatabaseDto attr : reqDto.getNodeRelationAttrGraphDatabaseList()) {
             query += attr.getAttributeName() + ": $" + attr.getAttributeName() + ", ";
         }
         query = query.substring(0, query.length() - 2); // Remove the last comma and space
         query += "}]->(" + (reqDto.getRelationDirection() != null && reqDto.getRelationDirection().equalsIgnoreCase("INCOMING") ? "a" : "b") + ")";

         Map<String,Object> param = new HashMap<>();
         param.put("nodeId",reqDto.getNodeId());
         param.put("relationNodeId",reqDto.getRelationNodeId());
         try (Session session = driver.session()) {
             Map<String, Object> parameters = param;
             for (NodeRelationAttrGraphDatabaseDto attr : reqDto.getNodeRelationAttrGraphDatabaseList()) {
                 parameters.put(attr.getAttributeName(), attr.getAttributeValue());
             }
             session.run(query, parameters);
         }
        return new AddNodeRelationGraphDatabaseRespDto();
      }
/**
      * code:deleteNodeRelationGraphDatabase
      * name:M2删除节点关系（特殊方法）
      * desc:undefined
      * gen by moon at 12/18/2024, 6:48:17 PM
      * 
      **/
     @Trace(operationName = "M2删除节点关系（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public DeleteNodeRelationGraphDatabaseRespDto deleteNodeRelationGraphDatabase(DeleteNodeRelationGraphDatabaseReqDto reqDto) {
         String query = "MATCH ()-[r:" + reqDto.getRelationType() + "]-()";
         if (reqDto.getRelationDirection() != null) {
             if ("OUTCOMING".equals(reqDto.getRelationDirection())) {
                 query += " WHERE STARTNODE(r).nodeId = $nodeId";
             } else if ("INCOMING".equals(reqDto.getRelationDirection())) {
                 query += " WHERE ENDNODE(r).nodeId = $nodeId";
             }
         }
         query += " DELETE r";

         Map<String, Object> param = new HashMap<>();
         param.put("nodeId", reqDto.getNodeId());

         try (Session session = driver.session()) {
             session.run(query, param);
         } catch (Exception e) {
             // 处理异常，例如记录日志或抛出自定义异常
             e.printStackTrace();
             throw new BizException("false",e,false);
         }
        return new DeleteNodeRelationGraphDatabaseRespDto();
      }
/**
      * code:exportDataToExcel
      * name:M2执行数据导出excel（特殊方法）
      * desc:undefined
      * gen by moon at 12/30/2024, 6:11:41 PM
      *
      **/
     @Trace(operationName = "M2执行数据导出excel（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementExportDataToExcelRespDto implementExportDataToExcel(ImplementExportDataToExcelReqDto reqDto) {
         ImplementExportDataToExcelRespDto retData = new ImplementExportDataToExcelRespDto();
// 创建Excel工作簿
         Workbook workbook = new XSSFWorkbook();
         // 创建一个工作表sheet
         Sheet sheet = workbook.createSheet("Sheet1");

         // 创建表头行
         Row headerRow = sheet.createRow(0);
         int column = 0;
         for (ExcelHeaderFieldDataDto field : reqDto.getExcelHeaderFieldDataList()) {
             Cell cell = headerRow.createCell(column++);
             cell.setCellValue(field.getExcelHeaderCnFields());
         }

         // 填充数据
         for (int i = 0; i < reqDto.getExportDataList().size(); i++) {
             Row row = sheet.createRow(i + 1);
             ExportDataDto rowData = reqDto.getExportDataList().get(i);
             for (int j = 1; j < 11; j++) {
                 Cell cell = row.createCell(j);
                 if(j==1){
                     cell.setCellValue(rowData.getExportDataFields1());
                 }else if(j==2){
                     cell.setCellValue(rowData.getExportDataFields2());
                 }else if(j==3){
                     cell.setCellValue(rowData.getExportDataFields3());
                 }else if(j==4){
                     cell.setCellValue(rowData.getExportDataFields4());
                 }else if(j==5){
                     cell.setCellValue(rowData.getExportDataFields5());
                 }else if(j==6){
                     cell.setCellValue(rowData.getExportDataFields6());
                 }else if(j==7){
                     cell.setCellValue(rowData.getExportDataFields7());
                 }else if(j==8){
                     cell.setCellValue(rowData.getExportDataFields8());
                 }else if(j==9){
                     cell.setCellValue(rowData.getExportDataFields9());
                 }else if(j==10){
                     cell.setCellValue(rowData.getExportDataFields10());
                 }
             }
         }

         // 自动调整列宽
         for (int i = 0; i < reqDto.getExcelHeaderFieldDataList().size(); i++) {
             sheet.autoSizeColumn(i);
         }

         // 将工作簿写入文件
         try (FileOutputStream fileOut = new FileOutputStream(reqDto.getExportExcelFileName() + "." +reqDto.getExportFileFormat())) {
             workbook.write(fileOut);
         } catch (IOException e) {
             e.printStackTrace();
         } finally {
             try {
                 workbook.close();
             } catch (IOException e) {
                 e.printStackTrace();
             }
         }
        return retData;
      }
/**
      * code:addMqQueueData
      * name:M2-新增MQ队列数据（特殊方法）
      * desc:undefined
      * gen by moon at 3/4/2025, 11:08:10 AM
      * 
      **/
     @Trace(operationName = "M2-新增MQ队列数据（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public AddMessageQueueDataRespDto addMessageQueueData(AddMessageQueueDataReqDto reqDto) {
         String topicName = reqDto.getMqQueueName() + "-" +reqDto.getMqPrimaryId();
         Producer producer = CommonFunctionHelper.getProducer();
         JSONObject jo = new JSONObject();
         for(FieldDataDto one : reqDto.getFieldDataList()){
             jo.put(one.getFieldName(),one.getFieldValue());
         }
         ProducerRecord<String, String> record = new ProducerRecord<>(topicName,reqDto.getMqSubNumer().intValue(), null, jo.toString());
         try {
             producer.send(record).get();
         } catch (InterruptedException e) {
             e.printStackTrace();
         } catch (ExecutionException e) {
             throw new BizException("-1",e.getMessage(),false);
         }
         return new AddMessageQueueDataRespDto();
      }
/**
      * code:registerMqQueue
      * name:M2-执行注册MQ队列（特殊方法）
      * desc:undefined
      * gen by moon at 3/4/2025, 11:08:32 AM
      * 
      **/
     @Trace(operationName = "M2-执行注册MQ队列（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public RegisterMessageQueueRespDto registerMessageQueue(RegisterMessageQueueReqDto reqDto) {
//         String addTopic = reqDto.getMqQueueName() + "-" + reqDto.getMqPrimaryId();
//         TopicPartition addTp = new TopicPartition(addTopic,0);
//         Consumer consumer = CommonFunctionHelper.getConsumer();
//         Set<TopicPartition> assignment = consumer.assignment();
//
//         if(!assignment.contains(addTp)){
//             List<TopicPartition> assignedPartitions = new ArrayList<>();
//             assignedPartitions.add(addTp);
//             CommonFunctionHelper.consumerLock.lock();
//             consumer.assign(assignedPartitions);
//             CommonFunctionHelper.consumerLock.unlock();
//
//         }
         return new RegisterMessageQueueRespDto();
      }
/**
      * code:updateCurMqQueueMin
      * name:M2-修改MQ队列最小值（特殊方法）
      * desc:undefined
      * gen by moon at 3/4/2025, 11:08:52 AM
      * 
      **/
     @Trace(operationName = "M2-修改MQ队列最小值（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public UpdateMessageQueueRespDto updateMessageQueue(UpdateMessageQueueReqDto reqDto) {
         String topicName = reqDto.getMqQueueName() + "-" + reqDto.getMqPrimaryId();
         TopicPartition topicPartition = new TopicPartition(topicName,reqDto.getMqSubNumer().intValue());
         Consumer consumer = CommonFunctionHelper.getConsumer();
         CommonFunctionHelper.consumerLock.lock();
         consumer.seek(topicPartition,reqDto.getMqQueueMinimum()+1);
         consumer.commitSync();
         CommonFunctionHelper.consumerLock.unlock();
        return new UpdateMessageQueueRespDto();
      }
/**
      * code:queryMqQueueDataList
      * name:M2-查询MQ队列数据列表（特殊方法）
      * desc:undefined
      * gen by moon at 3/4/2025, 11:09:16 AM
      * 
      **/
     @Trace(operationName = "M2-查询MQ队列数据列表（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryMessageQueueDataListRespDto queryMessageQueueDataList(QueryMessageQueueDataListReqDto reqDto) {
         QueryMessageQueueDataListRespDto retData = new QueryMessageQueueDataListRespDto();
         Map<String,Field> outDataFieldIndex = new HashMap<>();
         Field[] fields = FieldDataDto.class.getDeclaredFields();
         for(Field one : fields){
             one.setAccessible(true);
             outDataFieldIndex.put(one.getName(),one);
         }

         Map<String,String> mappingDataFieldIndex = new HashMap<>();
         for(MessageQueueDataDto one : reqDto.getMessageQueueDataList()){
             mappingDataFieldIndex.put(one.getFieldName(),one.getMapFieldName());
         }

         String topicName = reqDto.getMqQueueName()+"-"+reqDto.getMqPrimaryId();
         Consumer consumer = CommonFunctionHelper.getConsumer();
         TopicPartition targetTopic = new TopicPartition(topicName,reqDto.getMqSubNumer().intValue());
         List<TopicPartition> assignMents = new ArrayList<>();
         assignMents.add(targetTopic);
         consumer.assign(assignMents);

         ConsumerRecords<byte[],byte[]> recordList = consumer.poll(10000);
         if(!recordList.isEmpty()){
             for(ConsumerRecord<byte[],byte[]> oneData: recordList){
                 long offset = oneData.offset();
                 retData.setMqQueueMinimum(offset);
                 retData.setMqQueueName(reqDto.getMqQueueName());
                 retData.setMqPrimaryId(reqDto.getMqPrimaryId());
                 Object jsonString = oneData.value();
                 JSONObject consumerData = JSONObject.parseObject((String)jsonString);
                 FieldDataDto elm = new FieldDataDto();
                 elm.setMqDataPosition(offset);
                 for(Map.Entry<String,Object> oneField : consumerData.entrySet()){
                     Field field = outDataFieldIndex.get(mappingDataFieldIndex.get(oneField.getKey()));
                     try {
                         field.set(elm,oneField.getValue());
                     } catch (IllegalAccessException e) {
                         e.printStackTrace();
                     }
                 }
                 retData.getFieldDataList().add(elm);
                 consumer.seek(targetTopic,offset);
                 break;
             }

         }
        return retData;
      }

      private Long getMinOffset(AdminClient adminClient,String topicName,Long mqNum) throws ExecutionException, InterruptedException {
          Map<TopicPartition, OffsetSpec> request = new HashMap<>();
          request.put(new TopicPartition(topicName, mqNum.intValue()), OffsetSpec.earliest());
          Map<TopicPartition, ListOffsetsResult.ListOffsetsResultInfo> result = adminClient.listOffsets(request).all().get();
          long minOffset = result.get(new TopicPartition(topicName, mqNum.intValue())).offset();
          return minOffset;
      }

      private Long getMaxOffset(AdminClient adminClient,String topicName,Long mqNum) throws ExecutionException, InterruptedException {
          Map<TopicPartition, OffsetSpec> request = new HashMap<>();
          request.put(new TopicPartition(topicName, mqNum.intValue()), OffsetSpec.latest());

          Map<TopicPartition, ListOffsetsResult.ListOffsetsResultInfo> result = adminClient.listOffsets(request).all().get();
          long maxOffset = result.get(new TopicPartition(topicName, mqNum.intValue())).offset();
          return maxOffset;
      }

    private String findTopicWithUnconsumedData(AdminClient adminClient, String groupId,Long mqNum) throws ExecutionException, InterruptedException {
        // 获取所有Topic
        ListTopicsResult topicsResult = adminClient.listTopics();
        Set<String> topics = topicsResult.names().get();

        // 遍历所有Topic
        for (String topic : topics) {
            // 检查Topic是否包含 '-'
            if (topic.contains("-")) {
                // 获取消费组的消费偏移量
                ListConsumerGroupOffsetsResult offsetsResult = adminClient.listConsumerGroupOffsets(groupId);
                Map<TopicPartition, OffsetAndMetadata> offsets = offsetsResult.partitionsToOffsetAndMetadata().get();
                Map<TopicPartition, OffsetAndMetadata> filteredOffsets = new HashMap<>();
                // TODO: 2025/3/22 此处先硬编码0
                if(offsets!=null && offsets.size()>0){
                    for(Map.Entry<TopicPartition, OffsetAndMetadata> one : offsets.entrySet()){
                        TopicPartition tp = one.getKey();
                        if(tp.partition()==mqNum.intValue() && tp.topic().equals(topic)){
                            filteredOffsets.put(one.getKey(),one.getValue());
                        }
                    }
                }else if(offsets==null || offsets.size()==0){
                    Long min = getMinOffset(adminClient,topic,mqNum);
                    Long max = getMaxOffset(adminClient,topic,mqNum);
                    if(max - min ==0l){
                        continue;
                    }
                }

                if(filteredOffsets.size()==0){
                    Long min = getMinOffset(adminClient,topic,mqNum);
                    Long max = getMaxOffset(adminClient,topic,mqNum);
                    if(max - min ==0l){
                        continue;
                    }
                }

                // 判断消费组是否有提交位点
                boolean hasCommittedOffset = false;
                boolean hasBacklog = false;

                for (Map.Entry<TopicPartition, OffsetAndMetadata> entry : filteredOffsets.entrySet()) {
                    TopicPartition partition = entry.getKey();
                    if (partition.topic().equals(topic)) {
                        hasCommittedOffset = true;

                        long consumerOffset = entry.getValue().offset();
                        long latestOffset = getLatestOffset(adminClient, partition);

                        // 判断是否有消息积压
                        if (consumerOffset < latestOffset) {
                            hasBacklog = true;
                            break;
                        }
                    }
                }

                // 如果没有提交位点，返回该Topic
                if (!hasCommittedOffset) {
                    return topic;
                }

                // 如果有提交位点且有消息积压，返回该Topic
                if (hasBacklog) {
                    return topic;
                }
            }
        }

        return null;
    }

    private long getLatestOffset(AdminClient adminClient, TopicPartition partition) throws ExecutionException, InterruptedException {
        // 获取分区的最新偏移量
        ListOffsetsResult listOffsetsResult = adminClient.listOffsets(Collections.singletonMap(partition, OffsetSpec.latest()));
        return listOffsetsResult.partitionResult(partition).get().offset();
    }

/**
      * code:queryHaveDataMqQueue
      * name:M2-遍历查询有数据的MQ队列
      * desc:undefined
      * gen by moon at 3/6/2025, 12:13:59 AM
      *
      **/
     @Trace(operationName = "M2-遍历查询有数据的MQ队列")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryHaveDataMqQueueDetailRespDto queryHaveDataMqQueueDetail(QueryHaveDataMqQueueDetailReqDto reqDto) {
         QueryHaveDataMqQueueDetailRespDto retData = new QueryHaveDataMqQueueDetailRespDto();
         AdminClient adminClient = CommonFunctionHelper.getAdminClient();
         try {
             String topicWithUnconsumedData = findTopicWithUnconsumedData(adminClient, "component",reqDto.getMqSubNumer());
             if(topicWithUnconsumedData==null){
                 return retData;
             }
             if(topicWithUnconsumedData.contains("-")){
                 String[] splitors = topicWithUnconsumedData.split("-");
                 retData.setMqQueueName(splitors[0]);
                 retData.setMqPrimaryId(splitors[1]);
             }
         } catch (ExecutionException e) {
             throw new BizException("-1",e.getMessage(),false);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
         return retData;
      }
/**
      * code:nameCopy
      * name:M2执行名称副本处理（特殊方法）
      * desc:undefined
      * gen by moon at 6/2/2025, 12:03:36 PM
      *
      **/
     @Trace(operationName = "M2执行名称副本处理（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ImplementNameCopyHandleRespDto implementNameCopyHandle(ImplementNameCopyHandleReqDto reqDto) {
         ImplementNameCopyHandleRespDto retData = new ImplementNameCopyHandleRespDto();
         String copyName = "_副本";
         if(reqDto.getCopyName()!=null){
             copyName = reqDto.getCopyName();
         }
         if(reqDto.getComDatasList()!=null){
             for(ComDatasDto one : reqDto.getComDatasList()){
                 if(reqDto.getCustomField().equals(one.getCustomField2())){
                     retData.setNameCopyValue(reqDto.getCustomField() + copyName);
                     return retData;
                 }
             }
         }
         retData.setNameCopyValue(reqDto.getCustomField());
        return retData;
      }







    //手工接入方法
}
